Get the parts of a search string in java

www.‮iruttual‬.com
Get the parts of a search string in java
/**
 * @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
Created Time:2017-09-16 14:49:42  Author:lautturi