split   JAVA


Summary

Splits this string around matches of the given regular expression.


public String[] split(String regex)
public String[] split(String regex, int limit)

public class Split {

	public static void main(String[] args) {
		String str1 = "a b c";
		String[] words = str1.split("\\s");
		
		for (String wo : words ){
			System.out.println(wo);
		}
	}
}


Result

a
b
c

References


Tags

#array  #explode  #join  #split  #stringtokenizer  #tokenizer 


[ Edit (Author only) ]