Break Up Lines in string via regex - Java java.lang

Java examples for java.lang:String New Line

Description

Break Up Lines in string via regex

Demo Code

//package com.java2s;

public class Main {
    public static void main(String[] argv) {
        String string = "b\n\n\nook2s.com";
        System.out.println(java.util.Arrays.toString(BreakUpLines(string)));
    }/*w  w  w  .  java2s  .c om*/

    public static String[] BreakUpLines(String string) {
        return string.split("[\\n\\t]");
    }
}

Related Tutorials