StringTokenizer 用逗号分隔
public static void main(String args[]) {
StringTokenizer st = new StringTokenizer("apple,ball cat,dog", ",");
while (st.hasMoreTokens()) {
System.out.println(st.nextToken());
}
}
输出:
苹果
球猫
狗