I'm using the method quoteChar('"')
to treat the strings.
The usual escape sequences such as "\n" and "\t" are recognized and converted to single characters as the string is parsed.
Is there any way to get the string just the way it is, meaning that if i have the string:
Hello\tworld
i want to get
Hello\tworld
and not:
Hello world
. Thanks
Looking at the
StreamTokenizer
source, it looks like the escape behavior for strings is hard-coded. I can only think of a few ways to get around it:Reader
in between the sourceReader
and theStreamTokenizer
. Store all the chars read for the last token in a buffer. Trim whitespace from the start of that buffer to get the "raw" token.That what worked for me:
and then create the tokenizer by:
and get the new strval by