java String Split
Split New Line
*Nix line feed Example
Here is an example code assuming *Nix environment.
public class TestConsole { public static void main(String[] args) { String nixSampleLine = "Line 1 \n Line 2 \n Line 3"; String[] lines = nixSampleLine.split("\\r?\\n"); for (String line : lines) { System.out.println(line); } } }
Line 1 Line 2 Line 3
No comments