1

How to output the string with character escape sequences (e.g. in the Console)?

The goal is to display the "hidden" control characters from a string.

Example: For the string "first line second line with a tab... and more line breaks

Next line"

you want to see the output like in the visual studio

enter image description here

Is in .net something out of the box available for?

Alexander Zwitbaum
  • 4,776
  • 4
  • 48
  • 55
  • 3
    Possible duplicate of [Can I convert a C# string value to an escaped string literal](https://stackoverflow.com/questions/323640/can-i-convert-a-c-sharp-string-value-to-an-escaped-string-literal) – heijp06 Jul 06 '18 at 07:19
  • Unfortunately, the suggested ToLiteral does not work with a string, which is not declared in code, e.g. loaded from a database or read from a file. – Alexander Zwitbaum Jul 06 '18 at 09:47

0 Answers0