Write a string to the console window without escape characters

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.
 
G

Guest

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
 
T

Tiësto

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top