提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
StringTokenizer-返回分隔符和令牌
import java.util.StringTokenizer; public class Main { /** from nowjava**/ public static void main(String[] args) { StringTokenizer st = new StringTokenizer("Java|StringTokenizer|Example 1","|"); while(st.hasMoreTokens()) System.out.println(st.nextToken("|")); } }