Question : Remove Line Breaks in String

Hello,

I'm trying to eliminate Line breaks in c#.

E.g: I have string

str = "1234\567\890"
Here I'm getting everything in new line like
str = 1234 ;(Rest of the string is broken into new line)


I need everthing like str = 1234567890.

Thanks

Answer : Remove Line Breaks in String

Original question refers to an arbitrary string having backslash character at random positions, making the string to break the line and continue on the next one. Its wrong to assume the string will contain specifically the character sequence "\n\r" to be replaced. codes \01 to \09 also make the string to break..

in a string like:
string text = "asdada\01\02\03\04\05\06\07\08\09\a\b\f\fsdf\n\r\nadasdasdasd";

the proposed solution by Tiggerito will fail and the string will be truncated to "asdada";

btw, my proposed solution will fix the string correctly to
"asdada010203040506070809abffsdfnrnadasdasdasd";


regards.

Random Solutions  
 
programming4us programming4us