String replacement for insertion in the code

J

Joe Smith

Hi,

I haven't been able to find a short subject describing the problem (that's
also why I can't find anything in google).

I'll explain it with an example:

String original = "Hello\tbye\n";
String replaced = method(original); // Does this method exist??
System.out.println(replaced);

And what gets printed is:

Hello\tbye\n

With the escaping sequences "reversed". This way, I can copy the printed
sequence directly into the code; this may be useful, for instance, for
inserting String constants in the code, which have been programatically
created.

Does this exist?

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,479
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top