Java String Split by Separator splitToList(String s, String separator)

Here you can find the source of splitToList(String s, String separator)

Description

split To List

License

Open Source License

Declaration

public static List<String> splitToList(String s, String separator) 

Method Source Code

//package com.java2s;
/*//ww  w  .  j a v a2 s .  c  o m
 * Copyright (c) 2004-2012 The YAWL Foundation. All rights reserved.
 * The YAWL Foundation is a collaboration of individuals and
 * organisations who are committed to improving workflow technology.
 *
 * This file is part of YAWL. YAWL is free software: you can
 * redistribute it and/or modify it under the terms of the GNU Lesser
 * General Public License as published by the Free Software Foundation.
 *
 * YAWL 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 Lesser General
 * Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with YAWL. If not, see <http://www.gnu.org/licenses/>.
 */

import java.util.*;

public class Main {
    public static List<String> splitToList(String s, String separator) {
        if (isNullOrEmpty(s))
            return Collections.emptyList();
        return Arrays.asList(s.split(separator));
    }

    public static boolean isNullOrEmpty(String s) {
        return s == null || s.isEmpty();
    }
}

Related

  1. splitStaySeparator(String str, char token)
  2. splitString(String sInput, String sSeparator)
  3. splitStringToLong(String strInput, String separator)
  4. splitStringWithBracesOnSeparator(String string, char separator)
  5. splitStructs(String str, char separator)
  6. splitValues(String concatedValues, String separator)
  7. splitValues(String values, String separator)
  8. splitWithBreakingBrace(String str, char separator, char braceStart, char braceEnd)
  9. splitWithoutEscaped(String str, char separatorChar)