Write a string to the console window without escape characters

  • Thread starter Thread starter Tiësto
  • Start date Start date
T

Tiësto

Sometimes I have a string variable with many escaped characters. And when I
write

?MyString

in the Immediate window, the output is done with the \n \t and similar
characteres.
Is there any simple way to write the string as normal text?

Thank you.
 
A string like this:
"C:\\mydir\\myfile.txt"

Can be passed like this instead:
@"C:\mydir\myfile.txt"

As for tabs, line breaks and such, you will need to use their escape keys in
C#.

If you want to see the text without escape keys, you can pass the values to
a message box to debug and you will see the text as you may want to see it.

You can also create a text file log and post the string to it. Then you can
read it as you would normally see text. This is the best approach.

Rob
 
in windows applications I used to do that, but I have no MessageBox in Web
App, unless I add a reference to the assembly , which would be more
complicated than making a replace with notepad.
I wonder if Console.Write would work...

will try. Thnx anyway
 
Back
Top