Java Utililty Methods String Split by Delimiter

List of utility methods to do String Split by Delimiter

Description

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

Method

String[]split(String str, String delimiter, int limit)
split
ArrayList<String> splited = new ArrayList<String>();
int last = 0, pos, step = 0;
if (limit < 1) {
    limit = Integer.MAX_VALUE; 
while ((pos = str.indexOf(delimiter, last)) != -1 && ++step < limit) {
    splited.add(str.substring(last, pos));
    last = pos + 1;
...
String[]split(String str, String delims)
Split "str" by run of delimiters and return.
return split(str, delims, false);
Listsplit(String str, String regexDelim, int limitUseRegex)
Cutting a character string following a delimiter, with a limited use of delimiter "limitUseRegex" times.
return Arrays.asList(str.split(regexDelim, limitUseRegex));
String[]split(String string, String delim, boolean doTrim)
Splits a string into tokens.
int pos = 0, begin = 0;
List<String> resultList = new ArrayList<>();
while ((-1 != (pos = string.indexOf(delim, begin))) && (begin < string.length())) {
    String token = string.substring(begin, pos);
    if (doTrim)
        token = token.trim();
    if (token.length() == 0)
        token = null;
...
String[]split(String string, String delimiter)
Splits the given string by delimiter.
String[] result;
if (string == null) {
    result = new String[0];
    return result;
ArrayList list = new ArrayList();
do {
    int location = string.indexOf(delimiter);
...
String[]split(String string, String delimiter)
split
if (string == null || string.equals(""))
    return new String[0];
List<String> list = new ArrayList<String>();
int offset = 0;
for (;;) {
    int nextOffset = string.indexOf(delimiter, offset);
    if (nextOffset < 0) {
        list.add(string.substring(offset));
...
Listsplit(String stringToSplit, char delimiter)
Split a string into tokens identified by a delimiter character.
if (stringToSplit == null) {
    return null;
final char[] chars = stringToSplit.toCharArray();
List<String> tokens = new ArrayList<String>();
StringBuilder sb = new StringBuilder();
char c;
boolean lastWasDelimiter = false;
...
Listsplit(String strToSplit, char delimiter)
Split a string using indexOf and subsString, this is proved to be faster than String.split and StringUtils.split
List<String> parts = new ArrayList<>();
int foundPosition;
int startIndex = 0;
String part;
while ((foundPosition = strToSplit.indexOf(delimiter, startIndex)) > -1) {
    part = strToSplit.substring(startIndex, foundPosition);
    if (part.length() > 0) {
        parts.add(part);
...
Listsplit(String text, String delimiter)
split
String[] parts = text.split(delimiter);
List<String> list = new ArrayList<String>();
for (String part : parts) {
    list.add(part);
return list;
String[]split(String value, char delim)
Splits the specified String with the specified delimiter.
final int end = value.length();
final List<String> res = new ArrayList<String>();
int start = 0;
for (int i = 0; i < end; i++) {
    if (value.charAt(i) == delim) {
        if (start == i) {
            res.add(EMPTY_STRING);
        } else {
...