W
William Krick
Given a string "s", I'd like to convert all the line separators into
their "escaped" string equivalents. i.e. a dos/windows newline gets
converted into the literal string "\r\n".
I tried this in my java code...
s = s.replaceAll("\n", "\\n");
s = s.replaceAll("\r", "\\r");
but I end up with "rn" instead of "\r\n"
I assume the problem has something to do with the regex pattern
replacement but it seems like it should work.
What am I doing wrong?
....
Krick
their "escaped" string equivalents. i.e. a dos/windows newline gets
converted into the literal string "\r\n".
I tried this in my java code...
s = s.replaceAll("\n", "\\n");
s = s.replaceAll("\r", "\\r");
but I end up with "rn" instead of "\r\n"
I assume the problem has something to do with the regex pattern
replacement but it seems like it should work.
What am I doing wrong?
....
Krick