Rowdyone52
asked on
Remove newline from string
Why does this not work?
string x = "This is a test\r\nof the \r\nnewline character."
x = x.Replace(@"\n", "+").Replace(@"\r", "");
Watch x still equals "This is a test\r\nof the \r\nnewline character."
string x = "This is a test\r\nof the \r\nnewline character."
x = x.Replace(@"\n", "+").Replace(@"\r", "");
Watch x still equals "This is a test\r\nof the \r\nnewline character."
ASKER
Still doesnt replace with "+"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Well, I got the + on my string,
"This is a test+of the +newline character"
Forgot about putting it the way AlexNek, i.e. one call.
Anyway, as long as you get the solution
"This is a test+of the +newline character"
Forgot about putting it the way AlexNek, i.e. one call.
Anyway, as long as you get the solution
Why not?
ax = ax.Replace('\n', '+').Replace("\r", "");
System.Diagnostics.Debug.W
Will this do?