In C#, can I convert a string value to a string literal, the way I would see it in code? I would like to replace tabs, newlines, etc. with their escape sequences.
If
Code:
string someString1 = "\tHello\r\n\tWorld!\r\n"; string someString2 = @"\tHello\r\n\tWorld!\r\n"; Console.WriteLine(someString1); Console.WriteLine(someString2);
Output:
Hello World! \tHello\r\n\tWorld!\r\n
Is this what you want?