Reputation: 1930
I am downloading strings from a SQL-DB, which are formatted like this:
What's green and has wheels?
Grass, I lied about the wheels.
Now the problem is, is that I can't replace the newline in that string.
I tried:
myString = myString.Replace(System.Environment.NewLine, " ")
or .Replace("<br />", " ")
or .Replace("\r\n", " ")
or .Replace("\n", " ")
Upvotes: 0
Views: 1322
Reputation: 292355
The likeliest reason is that the newlines in the string are not \r\n
, but just \n
. Try to replace \n
instead.
EDIT: try to get the bytes from the string and post them here so that we can see the actual characters.
var bytes = Encoding.UTF8.GetBytes(myString);
string bytesAsString = BitConverter.ToString(bytes);
Upvotes: 4