java - Simple way to add escape characters to a string -


does have simple tool can convert non-escaped string escaped string?

for example, i'm trying paste following data java string datatype:

 <?xml version="1.0" encoding="utf-8" standalone="yes"?> 

i manually have add slashes:

 <?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?> 

then can paste java code:

 string xml="<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>"; 

adding slashes gets annoying when it's 3mb string. know find/replace can work in lot of tools, need faster way.

this must common issue. developers do? i'm thinking emacs macro trick didn't see obvious.

if it's 3mb string read file instead of hard-coding in source code.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -