Splits a string into an array using provided delimiter. Empty (but not blank) split chunks are omitted.
The split chunks are trimmed.

@param input string to split.
@param delimiter delimiter
@return a string split into an array using a provided delimiter
181858
public static String[] split(String input, char delimiter) {
        return split(input, String.valueOf(delimiter));
    }
452464
public static String arrayToList(String[] array, String delimiter) {
	if (ArrayUtil.isEmpty(array)) return "";
	StringBuilder sb = new StringBuilder(array[0]);

	if (delimiter.length() == 1) {
	    char c = delimiter.charAt(0);
	    for (int i = 1; i < array.length; i++) {
		sb.append(c);
		sb.append(array[i]);
	    }
	}
	else {
	    for (int i = 1; i < array.length; i++) {
		sb.append(delimiter);
		sb.append(array[i]);
	    }
	}

	return sb.toString();
    }
418905
public static String join(final Collection<String> chunks,
    final String delimiter) {
    StringBuilder sb = new StringBuilder();
    if (!chunks.isEmpty()) {
      Iterator<String> itr = chunks.iterator();
      sb.append(itr.next());
      while (itr.hasNext()) {
        sb.append(delimiter);
        sb.append(itr.next());
      }
    }
    return sb.toString();
  }
1322888
@Nonnull
    public static List<String> splitAtCommasAndTrim(Iterable<String> input) {
        if(input==null) {
            return Collections.emptyList();
        }
        Iterable<String> nonEmptyInputs = Iterables.filter(input, Predicates.notNull());
        return Lists.newArrayList(Iterables.concat(Iterables.transform(nonEmptyInputs, COMMA_SPLITTER)));
    }
543210
private static String[] split(String input) {
        char macroStart = MACRO_START.charAt(0);
        char macroEnd = MACRO_END.charAt(0);

        int startIndex = 0;
        boolean inMacro = false;

        List<String> list = new ArrayList<String>();

        for (int endIndex = 0; endIndex < input.length(); endIndex++) {
            char chr = input.charAt(endIndex);

            if (!inMacro) {
                if (chr == macroStart) {
                    String result = input.substring(startIndex, endIndex);
                    if (result.length() > 0) {
                        list.add(result);
                    }
                    inMacro = true;
                    startIndex = endIndex;
                }
            } else {
                if (chr == macroEnd) {
                    String result = input.substring(startIndex, endIndex + 1);
                    if (result.length() > 0) {
                        list.add(result);
                    }
                    inMacro = false;
                    startIndex = endIndex + 1;
                }
            }
        }

        String result = input.substring(startIndex);
        if (result.length() > 0) {
            list.add(result);
        }

        return list.toArray(new String[list.size()]);
    }
1304961
function splitToObj(str, delim) {
    if (!(_.isString(str))) {
        throw new Error(`Input must be a string: ${str}`);
    }
    else {
        return util_1.convertToObject(str.split(delim), () => true);
    }
}
229097
public static String[] splitToArray(String str, String separator, int limit, boolean isTrim, boolean ignoreEmpty){
		return toArray(split(str, separator, limit, isTrim, ignoreEmpty));
	}
865644
public static String[] split(String str, String separator){
    
    	return Pattern.compile(separator).split(str, -1);
    }
348168
public Collection<Text> split(Text separator) {
    	ArrayList<Text> tokens = new ArrayList<Text>();
    	int pointer = pos;
        int limit = pos + len;
        int mark = pointer;
        
        if(separator.length()==0)
    	{
        	tokens.add(new Text(chars, mark, pointer - mark));
    		return tokens;
    	}
    	
        int index=0;
        while (pointer < limit) {
            if (chars[pointer] == separator.charAt(index))
                index++;
            else 
            	index=0;
                        
            if(index==separator.length())
            {
            	tokens.add(new Text(chars, mark, pointer - mark));
                mark = pointer + 1;
                index=0;
            }
            
            pointer++;                    
        }
        
        tokens.add(new Text(chars, mark, limit - mark));        
        return tokens;
    }
453912
public static String[] tokenize(String str, String delimiters, boolean trim) {
        if (str == null) {
            return new String[0];
        }
        StringTokenizer st = new StringTokenizer(str, delimiters);
        List<String> tokens = new ArrayList<>();
        while (st.hasMoreTokens()) {
            tokens.add(trim ? st.nextToken().trim() : st.nextToken());
        }
        return tokens.toArray(new String[0]);
    }
476030
public static List<String> split(String input) {
        List<String> result = new ArrayList<>();
        StringBuilder cur = new StringBuilder();
        State state = State.START_FIELD;

        for (int i = 0; i < input.length(); i++) {
            char ch = input.charAt(i);
            switch (ch) {
                case ',':
                    switch (state) {
                        case IN_QFIELD:
                            cur.append(',');
                            break;
                        default:
                            result.add(cur.toString());
                            cur.setLength(0);
                            state = State.START_FIELD;
                            break;
                    }
                    break;
                case '"':
                    switch (state) {
                        case START_FIELD:
                            state = State.IN_QFIELD;
                            break;
                        case IN_QFIELD:
                            state = State.END_QFIELD;
                            break;
                        case IN_FIELD:
                            throw new CSVParseException("unexpected quote", input, i);
                        case END_QFIELD:
                            cur.append('"');
                            state = State.IN_QFIELD;
                            break;
                    }
                    break;
                default:
                    switch (state) {
                        case START_FIELD:
                            state = State.IN_FIELD;
                            break;
                        case IN_FIELD:
                        case IN_QFIELD:
                            break;
                        case END_QFIELD:
                            throw new CSVParseException("extra character after quoted string",
                                                        input, i);
                    }
                    cur.append(ch);
                    break;
            }
        }

        if (state == State.IN_QFIELD) {
            throw new CSVParseException("unclosed quote", input, input.length());
        }

        result.add(cur.toString());
        return result;
    }
165486
public static String[] splitOptions(String input) {

        //Note that we use a regex matching all "|" characters not prefixed by "\"

        //Since we define a regex for matching, the input delimiter "|" needs to be escaped, as well as "\",
        //which is even double-escaped - one escaping is due to the String, one due to the regex.

        // emulate missing lookbehinds in JS regexes by first reversing the input,
        // then using a split with lookaheads, and finally reversing the parts resulting
        // from the split
        String reverse = reverse(input);
        String[] parts = reverse.split("\\|(?!\\\\)");
        String[] finalParts = new String[parts.length];
        int lastIndex = parts.length - 1;
        for (int i = 0; i < parts.length; i++) {
            finalParts[lastIndex - i] = reverse(parts[i]);
        }
        return finalParts;

    }
855727
public static String join(String[] input, char separator) {
        //simple case, no escaping
        StringBuilder stringBuilder = new StringBuilder();
        for (String s : input) {
            if (stringBuilder.length() > 0) {
                stringBuilder.append(separator);
            }
            stringBuilder.append(s);
        }
        return stringBuilder.toString();
    }
716033
public static final List<DelimiterInfo> extractDelimiterList(final String str, final String delimiter) {
        assertStringNotNull(str);
        assertDelimiterNotNull(delimiter);
        final List<DelimiterInfo> delimiterList = new ArrayList<DelimiterInfo>();
        DelimiterInfo previous = null;
        String rear = str;
        while (true) {
            final int beginIndex = rear.indexOf(delimiter);
            if (beginIndex < 0) {
                break;
            }
            final DelimiterInfo info = new DelimiterInfo();
            info.setBaseString(str);
            info.setDelimiter(delimiter);
            final int absoluteIndex = (previous != null ? previous.getEndIndex() : 0) + beginIndex;
            info.setBeginIndex(absoluteIndex);
            info.setEndIndex(absoluteIndex + delimiter.length());
            if (previous != null) {
                info.setPrevious(previous);
                previous.setNext(info);
            }
            delimiterList.add(info);
            previous = info;
            rear = str.substring(info.getEndIndex());
            continue;
        }
        return delimiterList;
    }
629993
static List<String> split(String input)
    {
        if (input.isEmpty())
            return Collections.<String>emptyList();

        List<String> res = new ArrayList<String>();
        int prev = 0;
        for (int i = 0; i < input.length(); i++)
        {
            if (input.charAt(i) != ':' || (i > 0 && input.charAt(i-1) == '\\'))
                continue;

            res.add(input.substring(prev, i));
            prev = i + 1;
        }
        res.add(input.substring(prev, input.length()));
        return res;
    }
1108606
protected String[] splitToChunks(String str)
    {
        String delimiter = "[|>]";
        String[] chunks = str.split(delimiter);
        return chunks;
    }
1229086
public static String join(String delimiter, String... parts) {
    if (parts == null) {
      return null;
    }

    if (delimiter == null) {
      delimiter = "";
    }

    StringBuilder stringBuilder = new StringBuilder();
    for (int i=0; i < parts.length; i++) {
      if (i > 0) {
        stringBuilder.append(delimiter);
      }
      stringBuilder.append(parts[i]);
    }
    return stringBuilder.toString();
  }