Take a string of LS (either platform) separated strings and split them into an array containing one string per line. @param in string of lines to be split. @return an array containing individual lines.
(final String in)
| 601 | * @return an array containing individual lines. |
| 602 | */ |
| 603 | public static String[] splitLines(final String in) { |
| 604 | //return StringUtils.LS.equals("\n") ? in.split("\\\n") : in.split("\\\r\\\n"); //there must be a better way |
| 605 | final BufferedReader sr = new BufferedReader(new StringReader(in)); |
| 606 | final ArrayList<String> results = new ArrayList<>(); |
| 607 | String line; |
| 608 | try { |
| 609 | while ((line = sr.readLine()) != null) { |
| 610 | results.add(line); |
| 611 | } |
| 612 | } catch (final IOException ioe) { |
| 613 | throw new RuntimeException(ioe); |
| 614 | } |
| 615 | return results.toArray(new String[0]); |
| 616 | } |
| 617 | |
| 618 | /** |
| 619 | * Take a string of LS separated strings and sort them and return them as a concatenated (LS separated) string. |
no test coverage detected