This has been asked several times for several languages but I can\'t get it to work. I have a string like this
String str = \"This is a string.\\nThis is a l
That should work, but don't kill yourself trying to figure it out. Just use 2 passes.
str = str.replaceAll("(\r\n)", ""); str = str.replaceAll("(\n)", "");
Disclaimer: this is not very efficient.