StringTokenizer tt = new StringTokenizer("999,999,999",","); System.out.println(tt); String es=""; while (tt.hasMoreElements()) { es=(String)tt.nextElement()+es; System.out.println(es); } int wi=Integer.parseInt(es); System.out.println(wi);结果为:999999999
抱歉,没有System.out.println(tt);这句话。
StringTokenizer public StringTokenizer(String str, String delim, boolean returnDelims)Constructs a string tokenizer for the specified string. All characters in the delim argument are the delimiters for separating tokens. If the returnDelims flag is true, then the delimiter characters are also returned as tokens. Each delimiter is returned as a string of length one. If the flag is false, the delimiter characters are skipped and only serve as separators between tokens. Parameters: str - a string to be parsed. delim - the delimiters. returnDelims - flag indicating whether to return the delimiters as tokens.--------------------------------------------------------------------------------StringTokenizer public StringTokenizer(String str, String delim)Constructs a string tokenizer for the specified string. The characters in the delim argument are the delimiters for separating tokens. Delimiter characters themselves will not be treated as tokens. Parameters: str - a string to be parsed. delim - the delimiters.--------------------------------------------------------------------------------StringTokenizer public StringTokenizer(String str)Constructs a string tokenizer for the specified string. The tokenizer uses the default delimiter set, which is " \t\n\r\f": the space character, the tab character, the newline character, the carriage-return character, and the form-feed character. Delimiter characters themselves will not be treated as tokens. Parameters: str - a string to be parsed.
一般的可以:new Integer("9999").intValue();
System.out.println(tt);
String es="";
while (tt.hasMoreElements()) { es=(String)tt.nextElement()+es;
System.out.println(es);
}
int wi=Integer.parseInt(es);
System.out.println(wi);结果为:999999999
public StringTokenizer(String str,
String delim,
boolean returnDelims)Constructs a string tokenizer for the specified string. All characters in the delim argument are the delimiters for separating tokens.
If the returnDelims flag is true, then the delimiter characters are also returned as tokens. Each delimiter is returned as a string of length one. If the flag is false, the delimiter characters are skipped and only serve as separators between tokens.
Parameters:
str - a string to be parsed.
delim - the delimiters.
returnDelims - flag indicating whether to return the delimiters as tokens.--------------------------------------------------------------------------------StringTokenizer
public StringTokenizer(String str,
String delim)Constructs a string tokenizer for the specified string. The characters in the delim argument are the delimiters for separating tokens. Delimiter characters themselves will not be treated as tokens. Parameters:
str - a string to be parsed.
delim - the delimiters.--------------------------------------------------------------------------------StringTokenizer
public StringTokenizer(String str)Constructs a string tokenizer for the specified string. The tokenizer uses the default delimiter set, which is " \t\n\r\f": the space character, the tab character, the newline character, the carriage-return character, and the form-feed character. Delimiter characters themselves will not be treated as tokens. Parameters:
str - a string to be parsed.
1.int型最大可为:2,147,483,647
2.要去了字符中的‘,’