What would be the fastest way to remove Newlines from a String in C#?
Like this:
string s = "hello\nworld";
s = s.Replace(Environment.NewLine, ",");
Why not:
string s = "foobar\ngork";
string v = s.Replace(Environment.NewLine,",");
System.Console.WriteLine(v);
Don't reinvent the wheel — just use:
myString.Replace(Environment.NewLine, ",")
string sample = "abc" + Environment.NewLine + "def";
string replaced = sample.Replace(Environment.NewLine, ",");