I want to replace a "
followed by \n\r (enter)
with just "
I've tried multiple variations on:
receivedData = receivedData.replaceAll(\\" + [\n\r], \\", );
How does one replace a combination of characters and symbols / carriage return / line feed?
EDIT: Still not solved using current suggestion , I still get the following lines back which I want to be on one line:
+CMGL: 1,"REC READ","+31626187086",,"16/11/25,09:33:58+04"
Test
Using literals for new line characters is dangerous, since it's platform dependent or may contain a typo (wrong order of \n\r
chars). I'd recommend using System.lineSeparator()
method instead.
So your code in this case may look like:
receivedData = receivedData.replaceAll("\"" + System.lineSeparator(), "\"");