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