Reputation: 369
Maybe someone can help me with the following problem. i have text containing "\line" like Username \line Firstname \line. I want to replace this with \r\n. My code:
string _text = query;
_text.Replace("\Line", " \r\n");
It gives the following error: Unrecognized escape sequence.
Anyone wit a solution?
Thanks!
Upvotes: 2
Views: 50
Reputation: 4808
You need to escape the backslash
_text.Replace("\\Line", " \r\n");
Alternatively you could try the string literal (haven't tried this though):
_text.Replace(@"\Line", " \r\n");
Upvotes: 3