Can someone tell me exactly what is this regex doing?
new StringTokenizer(string,":/.@\\;,+ ");
I could not understand the exact meaning of this Regex, though it loo开发者_如何学JAVAks like something to do with splitting a string based on special characters?
StringTokenizer
does not use regular expressions. The second parameter is a list of characters to be used as separators between tokens.
The JavaDoc says:
StringTokenizer
is a legacy class that is retained for compatibility reasons although its use is discouraged in new code. It is recommended that anyone seeking this functionality use thesplit
method ofString
or thejava.util.regex
package instead.
StringTokenizer
does not use regular expressions. The second argument is just the list of delimiters that it will use by default to split apart the string.
There is no regex in this code. the second argument is contains the list of the delimiters used to tokenize the string.
精彩评论