Monday, November 19, 2012

How to get Comma Seperated Value ?

How to get Comma Seperated Value ?

Use of  StringTokenizer class.

String str = "neel,mani,jaiswal";
StringTokenizer st = new StringTokenizer(str, ",");
while (st.hasMoreTokens()) {
     System.out.println(st.nextToken());
}
O/P :

neel
mani
jaiswal