StringTokenizer: String delimited parsing type
1. Constructor.
1. StringTokenizer(String str): Construct a StringTokenizer object for parsing str. The default delimiters in java are "space", "tab ('\t')", "newline ('\n')", "carriage return ('\r')".
2. StringTokenizer(String str, String delim): Construct a StringTokenizer object for parsing str and provide a specified delimiter.
3. StringTokenizer(String str, String delim, boolean returnDelims): Construct a StringTokenizer object for parsing str, and provide a specified delimiter, and at the same time, specify whether to return the delimiter.
Second, the method.
Description:
1. All methods are public;
2. Writing format: [modifier] <return type> <method name ([parameter list])>
such as:
static int parseInt(String s) Indicates: this method (parseInt) is The class method (static), the return type is (int), and the required parameters of the method are String type.
int countTokens() :返回nextToken方法被调用的次数。如果采用构造函数1和2,返回的就是分隔符数量(例2)。
boolean hasMoreTokens() :返回是否还有分隔符。
boolean hasMoreElements() :结果同2。
String nextToken() :返回从当前位置到下一个分隔符的字符串。
Object nextElement() :结果同4。
String nextToken(String delim) :与4类似,以指定的分隔符返回结果。