//author:
Tao Sun要对一格字符串分割,本来可以用split,但是要指定多个分割字符的话就要用StringTokenizer了.下面是个简单的程序测试,分别用汉字逗号和英文逗号分割字符串.
String abc = new String("因子1,因子2,因子3");
try {
StringTokenizer tokenizer = new StringTokenizer(abc, ",,");//can add more in the
delim while (tokenizer.hasMoreTokens()) {
String yz= tokenizer.nextToken();
System.out.println("result: " + yz);
}
}
catch (Exception ee) {
System.out.println(ee.toString());
}