I have Windows Forms UI, that allows me to enter format for string formatting in TextBox, like:
Enter result format: {sku}:{value} \n
Problem is, that \n is getting escaped, so result format string in debug view looks like:
{sku}:{value} \\n
And that produces \n instead of line break in result.
So question is, how to prevent this, or how to remove escaping before using in StringBuilder.AppendFormat()
Update: I've decided to add image from notepad++ window, may be that will help understand what I need and why (although my use case is a bit different, I think idea is the same):

Probably, what you want to do is to use the string.Replace(@"\n", "\n") method. View more at http://msdn.microsoft.com/en-us/library/system.string.replace.aspx
There is a general way of doing the unescaping of the string is to use regular expression
System.Text.RegularExpressions.Regex.Unescape(yourStringVariable);
How can I Unescape and Reescape strings in .net?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With