StringTokenizer

   StringTokenizer st = new StringTokenizer("this is a test");      

 while (st.hasMoreTokens()) {

           System.out.println(st.nextToken());      

 }        

 

String[] result = "this is a test".split("\\s");      

 for (int x=0; x<result.length; x++)          

System.out.println(result[x]);  

posted @ 2012-01-14 14:30  greencolor  阅读(138)  评论(0编辑  收藏  举报