StringTokenizer的用法
作者:互联网
能将一个字符串按照指定字符进行分割,默认为空格
package Test;
import java.util.*;
public class test0408 {
public static void main(String[] args) {
StringTokenizer st = new StringTokenizer("123/456", "/");
while(st.hasMoreElements()){
System.out.println(st.nextToken());
}
}
}
123
456
hasMoreElements(): 返回布尔型,如果还有分隔成的字符串返回true ,否则返回false
nextToke():相当于Scanner in ,in.nextInt();
标签:hasMoreElements,456,st,123,StringTokenizer,用法,public 来源: https://blog.csdn.net/han_hhh/article/details/89307053