/**
* @author lautturi.com
* Java example: split the phrase by any number of commas or space characters, which include " ", \r, \t, \n and \f
*/
import java.util.*;
public class Lautturi {
public static void main(String[] args) {
String str = "hello lautturi, java world";
String[] matches = str.split("[\\s,]+");
for (int i=0;i<matches.length;i++)
System.out.println(matches[i]);
}
}
output:
hello lautturi java world