StringTokenizer用法

import java.util.StringTokenizer;
public class StringTokenizerTest {

    public static void main(String[] args)
    {
        String str="数学::英语::语文::化学";
        StringTokenizer st=new StringTokenizer(str,"::");
        System.out.println(st.countTokens());
        
        while(st.hasMoreTokens())
        {
            System.out.println(st.nextToken());
            
        }
    }
}

 

posted @ 2013-08-30 15:48  fang_beny  阅读(786)  评论(0编辑  收藏  举报