STRING TOKENIZER DEMO
STringtokenizer
string tokenizer
/** * */ /** * @author arun * */ import java.util.StringTokenizer; public class StringTokenizerDemo { static String s = "company=civanatic corp;"+ "contry=USA;"+ "state=texas;"+ "city=irving;"+ "zip=75063;"; public static void main(String[] args) { StringTokenizer st = new StringTokenizer(s,"=;"); while(st.hasMoreTokens()){ String key = st.nextToken(); String value = st.nextToken(); System.out.println(key + "\t" + value); } } } /* output contry USA state texas city irving zip 75063 */
Please send comments to
vgdarur.javafive@blogger.com
Copyright © 2008 - iForeRunner.com
http://www.iforerunner.com/