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
A little more robust version of what you're attempting:
str = str.replaceAll("(\r\n|\n\r|\r|\n)", "");