Reputation: 875
Explain this:
"\t\n\r\">#"
it's used in Java tokenizer.
StringTokenizer st = new StringTokenizer(remaining, "\t\n\r\">#");
Upvotes: 0
Views: 9164
Reputation: 351
This is not a regexp,this means
\t is tab \n is end of line \r is carriage return \" is " character ">" and "#" are the respective characters.
This string tokenizer will break the string "remaining" into tokens, separating the string in any of the previous characters.
Upvotes: 0
Reputation: 612954
That's a delimiter set for the tokenizer. It is not a regular expression as you originally suspected.
From the documentation of the StringTokenizer
constructor:
The characters in the delim argument are the delimiters for separating tokens. Delimiter characters themselves will not be treated as tokens.
The documentation for the constructor overload that does not have the delim
argument gives an idea of what type of string might be expected:
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.
The code you have is specifying a different set of delimiters from the default.
Upvotes: 7
Reputation: 93167
\t
is a character meaning "horizontal tab"\n
is a character meaning "line feed" (LF)\r
is a character meaning "carriage return" (CR)As for the question itself, it's not a regular expression but a set of delimiter characters.
Resources :
Upvotes: 2