I have a following line of code:
string str = "\"\\trandom string\\n\"";
and now I need a method to get:
string result = "\trandom string\n";
Just like how the compiler deals with quoted strings.
Note that the string str is random, which means any character, including '\t', '\n', '\"', etc may appear in the result.
My question is: Is there an existing method in C# that I can use? If not, do you have any suggestions?
EDIT:
What I want is:
"\\t" -> '\t'
"\\n" -> '\n'
"\\\\" -> '\\'
etc. anything that is not literal within the quotation marks