Java String Split by Regex splitList(String list, String splitRegex)

Here you can find the source of splitList(String list, String splitRegex)

Description

split List

License

Open Source License

Declaration

public static List<String> splitList(String list, String splitRegex) 

Method Source Code

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

import java.util.ArrayList;

import java.util.List;

public class Main {
    public static List<String> splitList(String list, String splitRegex) {
        String[] parts = list.split(splitRegex);
        List<String> finalParts = new ArrayList<String>();
        for (String part : parts) {
            if (!part.equals("")) {
                finalParts.add(part);/*from w  w  w.java  2  s.  c o  m*/
            }
        }
        return finalParts;
    }

    public static List<String> splitList(String list) {
        return splitList(list, ",");
    }
}

Related

  1. split(String str, String regex)
  2. split(String str, String regex)
  3. split(String string, String pattern)
  4. split(String text, String pattern)
  5. splitAndTrim(String s, String regex)
  6. splitNoEmpty(String sStr, String regex)
  7. splitString(String str, List list, String regex)
  8. splitStringToList(String input, String regex)
  9. splitTerms(String text, String pattern)