Here you can find the source of splitLines(String text)
Parameter | Description |
---|---|
text | a parameter |
public static List<String> splitLines(String text)
//package com.java2s; /*// w ww. j a v a2 s .com * Password Management Servlets (PWM) * http://code.google.com/p/pwm/ * * Copyright (c) 2006-2009 Novell, Inc. * Copyright (c) 2009-2014 The PWM Project * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class Main { /** * Split the string in lines; separate by CR, LF or CRLF. * * @param text * @return list of Strings */ public static List<String> splitLines(String text) { List<String> list = new ArrayList<>(); if (text != null) { String lines[] = text.split("\r?\n|\r"); list.addAll(Arrays.asList(lines)); } return list; } }