How do I remove \r\n from string in C#?

c#, string

Solution

This reads better:

text = text.Replace(System.Environment.NewLine, string.Empty);

Problem

I am trying to figure out an easy way remove \r\n from a string. Example: text = "this.is.a.string.\r\nthis.is.a.string\r\n" I tried: `text.Replace("\r\n", "")` and `text.Replace("\r\n", string.Empty)`, but it doesn't work. `\r\n` is still in the string... The result should be: "this.is.a.string.this.is.a.string"

Original source

Related problems