NOTE: I didn't want to make the question too long, so "how" from the question title translates into "is there a method for this in .Net framework".
Just a reminder:
\n
if the above is printable representation of the string, then its internal version is one character, not two, which code is 0x0a.
However I could write:
string s = "\\n"; // three characters in editor
which translates to internal representation of 2 characters \
and n
. This is not 0x0a character!
But I would like to achieve this. I.e. I have already in string some data, which I know is printable representation of a string. And I would like to convert it to internal representation (something C# compiler does all the time).
string printable = "\\n";
string internal_ = convert(printable);
internal_
would hold only one character now, of code 0x0a.
Question: is there ready to use (!) function for such conversion?