How can I remove multiple rows from a row, so I only get one row, if any. For example, I have a line with "\r\n\r\n\r\n\r\n\r\n\r\n\r\n" , how can I turn this into one '\n' ?
"\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
'\n'
You can use:
myString = myString.replaceAll("[\r\n]+", "\n");
On Android, I managed to remove more than two line breaks with this
textPiece = textPiece.replaceAll("\n\n\n+", "\n\n");