Afnan Bashir Afnan Bashir - 1 year ago 62
C# Question

Remove \r from string

I have some Html in string I have tried utmost to remove \r many times but fails.

text.Replace("\r\n", "").Replace("\r", "").Replace("\n", "");

Answer Source

You need to assign the result back to text, like:

text = text.Replace("\r\n", "").Replace("\r", "").Replace("\n", "");