One long question :)
This is how I usually do it:
StringBuilder b = new StringBuilder();
BufferedReader r = new BufferedReader(new StringReader(s));
while ((String line = r.readLine()) != null)
b.append(doSomethingToTheString(s) + "\n");
However, this replaces all new string characters in the file with a line feed, plus adds one to the end if there was none. I want to keep the EOL characters even if they are mixed like this:
Hello\r\n
World\n
This is\r
Messed up
What would be the most elegant / efficient way to do this?
eomer source
share