summaryrefslogtreecommitdiffstats
path: root/Master/Reference Architectures and Patterns/hjp5/examples/Listing1704.java
blob: f58195dd9792fe2c8ef0e95c8253c0ae8c598733 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* Listing1704.java */

import java.util.regex.*;

public class Listing1704
{
  public static void main(String[] args)
  {
    // Der zu verwendende Testsatz
    String satz = "Dies ist nur ein Test";
    
    // Jedes Whitespace-Zeichen soll zur 
    // Trennung verwendet werden
    Pattern p = Pattern.compile("\\s");
    
    // Verwendung der Methode split
    String[] result = p.split(satz);
    for (int x=0; x<result.length; x++) {
      System.out.println(result[x]);
    }
  }
}