I currently have a UTF8 string that contains nulls, backspaces, etc. inside the string. I am trying to escape the string so that control characters are visible in their escaped form. Basically, the input/output I want looks like this:
String inString = "String\u0000 with\u0008 stuff \u000a in it";
String outString = "String\\0 with\\b stuff \\n in it";
I don't want to write a regex searching for all the escape characters, but I couldn't seem to find any inbuilt functions to do this. Is regex my only option?
Thanks!