Given a string that isn\'t too long, what is the best way to read it line by line?
I know you can do:
BufferedReader reader = new BufferedReader(new
Using Apache Commons IOUtils you can do this nicely via
List lines = IOUtils.readLines(new StringReader(string));
It's not doing anything clever, but it's nice and compact. It'll handle streams as well, and you can get a LineIterator too if you prefer.
LineIterator