Java Utililty Methods String Split by Separator

List of utility methods to do String Split by Separator

Description

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

Method

String[]split(final String str, final char separatorChar)
split
if (str == null) {
    return null;
final int len = str.length();
if (len == 0) {
    return EMPTY_STRING_ARRAY;
final List<String> list = new ArrayList<>();
...
Listsplit(final String str, final char separatorChar)
split
return split(str, separatorChar, 10);
Listsplit(final String str, final char[] separators)
Split string to array.
int lastPos = 0;
List<String> arr = new ArrayList<String>();
for (int pos = 0; pos != str.length(); ++pos) {
    char ch = str.charAt(pos);
    for (char sep : separators) {
        if (ch == sep) {
            if (lastPos != pos) {
                arr.add(str.substring(lastPos, pos));
...
Listsplit(final String text, final char separator)
Splits text around separator.
final List<String> strings = new ArrayList<>();
final int length = text.length();
final char[] characters = new char[length + 1];
characters[length] = separator;
text.getChars(0, length, characters, 0);
int start = 0, end = 0;
for (final char letter : characters) {
    if (letter == separator) {
...
Listsplit(final String text, final String separator)
Returns a list of text parts splitted using specified separator.
return Arrays.asList(text.split(separator));
ArrayListsplit(final T string, final char separator)
split
final ArrayList<T> split = new ArrayList<T>(8);
int last = 0;
for (int i = 0; i < string.length(); i++) {
    if (string.charAt(i) == separator) {
        split.add((T) string.subSequence(last, i));
        last = ++i;
if (last == 0)
    split.add(string); 
else
    split.add((T) string.subSequence(last, string.length()));
return split;
String[]split(String array, String separators)
split
final List list = splitAsList(array, separators);
return (String[]) list.toArray(new String[list.size()]);
Listsplit(String input, int separator)
split
List<String> retval = new ArrayList<String>();
if (input == null)
    return retval;
int index = 0, end;
while (true) {
    index = input.indexOf(separator, index);
    if (index == -1)
        break;
...
Listsplit(String left, String separator)
split
List<String> results = new ArrayList<>();
if (left == null || left.isEmpty())
    return results;
for (String str : left.split(separator)) {
    if (str != null && !str.isEmpty())
        results.add(str);
return results;
...
String[]split(String s, char separator)
split
java.util.List<String> list = storage.get();
list.clear();
StringBuilder sb = new StringBuilder();
boolean escaping = false;
char escape = '\\';
char prev;
char[] cs = s.toCharArray();
for (int i = 0; i < cs.length; i++) {
...