Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

StringTokenizer problem when using newline as delimiter ???

807580Mar 9 2010 — edited Mar 9 2010
Hi,

I may get a string value as "\\n" or "\\t" or "\\s".

I need to use them and tokenize a string based on the escape character given.

When i tokenize i come across a weired behaviour as "\\n" is not working where as "\n" is working.

StringTokenizer st = new StringTokenizer(string, "\\n"); --> not working
StringTokenizer st = new StringTokenizer(string, "\n"); --> working

I'm not sure how to extract "\n" or "\t" or "\s" from the above string

so please help how to extract and resolve the tokenize problem.

Thanks,
Kathir
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 6 2010
Added on Mar 9 2010
10 comments
5,695 views