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!

Parsing a string with escape characters

807580May 5 2006 — edited Nov 12 2009
Hello all,

Suppose I have a one-line input file with the following contents:
\u1234\u4567\u7890\t
Suppose I read this file into a String inputStr. I want to reach the following goal:
inputStr.compareTo("\u1234\u4567\u7890\t") == 0
In other words, I want to parse a string and handle the escape sequences in the same way that Java handles them (things like \t, \n, \r, etc). Is there an existing parser which I can conveniently use to achieve my goal, or do I have to write my own one?

Thanks in advance.

Cheers,
Sam
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 10 2009
Added on May 5 2006
16 comments
3,583 views