Friday, August 28, 2009

Parsing Character-Separated Data in Java

In order to parse data based on some character, Split method is used. There is another approch called StringTokenizer which is more powerful than Split.

String names = "Ali Anuj Munjal Jigar Kamesh Harish Kamesh";
List lstoriginal = Arrays.asList(names.split(" "));
System.out.println("Element in List"+lstoriginal);

Author : Anuj Patel
Blog : http://goldenpackagebyanuj.blogspot.in/