Hi, I have two related questions.
1) suppose that:
string strMessage = "\ nHellow \ n \ nWorld"; console.writeln (strMessage);
Result:
Hello
World
Now, if we want to show the string in its original format in One Line, we must redefine the first variable from scratch.
string strOrignelMessage = @ "\ nHellow \ n \ nWorld";
console.writln (strOrignelMessage);
Result: \ nHellow \ n \ nWorld ---------------------> and everything is in order.
I am wondering if there is a way to avoid defining a new variable (strOrignelMessage) in the code for this purpose and only using only the first string variable (strMessage) and apply some tricks and print them on one line.
I tried the following workaround first, but it causes some errors. Suppose we have:
string strMessage = "a \ aa \ nbb \ nc \ rccc";
string strOrigenalMessage = strMessage.replace ("\ n", "\\ n"). replace ("\ r", "\\ r");
Console.writeln (strOrigenalMessage)
the result is: aa \ nbb \ nc \ rccc
note that before the first "\" is not printed . Now my second question:
2) How can we fix a new problem with a single "\" in the line
I hope this problem is resolved correctly, and my explanations will be enough, thanks