Here you can find the source of toListOfNonEmptyStringsDelimitedByCommaOrSemicolon(String s)
public static List toListOfNonEmptyStringsDelimitedByCommaOrSemicolon(String s)
//package com.java2s; import java.util.*; public class Main { /**//ww w .j av a2s .c o m * Define split characters * */ private final static String SEPARATOR = "[,;]"; public static List toListOfNonEmptyStringsDelimitedByCommaOrSemicolon(String s) { if (s == null) return Collections.EMPTY_LIST; List results = new ArrayList(); String[] terms = s.split(SEPARATOR); for (int i = 0; i < terms.length; i++) { String term = terms[i].trim(); if (term.length() > 0) { results.add(term); } } return results; } }