Java Utililty Methods String Split

List of utility methods to do String Split

Description

The list of methods to do String Split are organized into topic(s).

Method

Listsplit(String value)
split
final String[] values = value.split(",");
return Arrays.asList(values);
String[]split(String value)
Splits the given string to substrings separated by following symbols (one or more): ',', ';', ' ', '\t', '\n', '\r'.
List<String> list = new ArrayList<String>();
if (value != null && !"".equals(value)) {
    char[] array = value.toCharArray();
    StringBuffer buf = new StringBuffer();
    for (char ch : array) {
        if (ch == ',' || ch == ';' || ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') {
            if (buf.length() > 0) {
                list.add(buf.toString());
...
String[]split_fields(String str)
splifields
List list = new ArrayList(16);
StringBuffer sb = new StringBuffer();
for (int i = 0; i < str.length(); i++) {
    char c = str.charAt(i);
    if (c == '\t') {
        list.add(sb.toString());
        sb = new StringBuffer();
    } else {
...
Listsplit_str(String input, String split)
splistr
List<String> result = new ArrayList<String>();
int index = input.indexOf(split);
int beg = 0;
while (index != -1) {
    String str = input.substring(beg, index);
    beg = index + 1;
    result.add(str);
    index = input.indexOf(split, beg);
...
ListsplitAndTrim(String str)
Splits the lines of a string, and trims each line.
String[] strs = str.split("\n");
List<String> list = Arrays.asList(strs);
trim(list);
for (int i = list.size() - 1; i >= 0; i--)
    if (list.get(i).isEmpty())
        list.remove(i);
return list;
String[]splitAndTrim(String str, String splitBy)
split And Trim
String[] split = str.split(splitBy);
ArrayList<String> r = new ArrayList<>(split.length);
for (String s : split) {
    s = s.trim();
    if (!s.isEmpty())
        r.add(s);
return r.toArray(new String[r.size()]);
...
String[]splitAndUnEscape(String str)
Split a string using the default separator/escape character, then unescape the resulting array of strings
return splitAndUnEscape(str, ESCAPE_CHAR, COMMA);
String[]splitArgs(String args, int expectedArgs)
split Args
String[] raw = args.split("\\s+", expectedArgs);
if (expectedArgs < 1)
    return raw;
return normalizeArray(raw, expectedArgs);
String[]splitArguments(final String str)
split Arguments
final char[] charArray = str.toCharArray();
final List<String> args = new ArrayList<>(10);
StringBuilder builder = new StringBuilder(32);
boolean isBuildingString = false;
char buildingChar = NULL_CHAR;
for (int i = 0, charArrayLength = charArray.length; i < charArrayLength; i++) {
    final char c = charArray[i];
    switch (c) {
...
String[]splitArguments(String arguments)
split Arguments
boolean inQuotes = false;
ArrayList<String> arrayList = new ArrayList<String>();
int firstChar = 0;
int i;
char ch;
for (i = 0; i < arguments.length(); i++) {
    ch = arguments.charAt(i);
    if (ch == '\\' && arguments.charAt(i + 1) == '\"') {
...