Java String Split by Line splitMultiline(String text, boolean trimLines)

Here you can find the source of splitMultiline(String text, boolean trimLines)

Description

split Multiline

License

Open Source License

Declaration

public static List<String> splitMultiline(String text, boolean trimLines) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.*;

public class Main {
    public static List<String> splitMultiline(String text, boolean trimLines) {
        final List<String> result = new ArrayList<>();
        final String[] lines = text.split("\\r\\n|\\n|\\r");
        for (String line : lines) {
            result.add(trimLines ? line.trim() : line);
        }//from   w w w.j a  v  a 2s . com
        return result;
    }
}

Related

  1. splitLines(String str, int width)
  2. splitlines(String text)
  3. splitLines(String text)
  4. splitLines(String text)
  5. splitLogLine(final String logLine)
  6. splitNewLines(final String input)
  7. splitNextWord(String line)
  8. splitString(String line)
  9. splitStringPerWord(String string, int wordsPerLine)