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

String[]split(String s, String splitStr)
Split but also trim whiespace.
return stream(s.split(splitStr)).map(String::trim).toArray(String[]::new);
String[]split(String s, String splitter)
split
if (s == null) {
    throw new IllegalArgumentException("The string to be splitted cannot be null");
if (splitter == null || splitter.length() == 0) {
    throw new IllegalArgumentException("The string splitter cannot be empty");
List<String> parts = new ArrayList<>();
int n = splitter.length();
...
Listsplit(String self)
split
return split(self, null, true);
Listsplit(String signature, boolean skipInitialAngleBracket)
split
List<String> result = new ArrayList<>();
if (signature.charAt(0) != '<') {
    skipInitialAngleBracket = false;
int depth = 0;
int start = 0;
for (int pos = start; pos < signature.length(); pos++) {
    switch (signature.charAt(pos)) {
...
ArrayListsplit(String source, String seperator)
Splits a string into different parts, using a seperator string to detect the seperation boundaries in a case-sensitive manner.
return split(source, seperator, true);
String[]split(String str)
split
return split(str, null, -1);
Listsplit(String str)
split
String[] terms = str.split(",");
List ret = new ArrayList();
for (int i = 0; i < terms.length; i++) {
    String t = terms[i].trim();
    if (t.length() > 0) {
        ret.add(t);
return ret;
String[]split(String str)
split
return split(str, null, -1);
String[]split(String str)
split
ArrayList<String> list = new ArrayList<>();
int s = 0, n = str.length();
for (;;) {
    while (s < n && Character.isWhitespace(str.charAt(s)))
        s++;
    if (s == n)
        break;
    int t = s;
...
String[]split(String str)
Split a string using the default separator
return split(str, ESCAPE_CHAR, COMMA);