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[]splitString(String splitStr, String delim)
split String
int i, count;
String[] result;
StringTokenizer toker;
toker = new StringTokenizer(splitStr, delim);
count = toker.countTokens();
result = new String[count];
for (i = 0; i < count; ++i) {
    try {
...
String[]splitString(String str, char delim)
split String
return splitString(str, String.valueOf(delim));
String[]splitString(String str, String delim)
split String
java.util.List<String> l = new java.util.ArrayList<>();
char[] arr = new char[str.length()];
int pos = 0;
int n = 0;
char quoteChar = '\0';
while (pos < str.length()) {
    if (quoteChar == '\0' && (str.charAt(pos) == '"' || str.charAt(pos) == '\'')) {
        quoteChar = str.charAt(pos++);
...
String[]splitString(String str, String delimiter)
Manual split function to avoid depending on guava.
if (str == null || str.length() == 0) {
    return new String[] { "" };
List<String> categories = new ArrayList<String>();
int dLen = delimiter.length();
int begin = 0;
for (int i = 0; i < str.length(); i++) {
    if (str.substring(i, Math.min(i + dLen, str.length())).equals(delimiter)) {
...
String[]splitString(String str, String delims)
split String
if (str == null)
    return null;
else if (str.equals("") || delims == null || delims.length() == 0)
    return new String[] { str };
String[] s;
Vector v = new Vector();
int pos, newpos;
pos = 0;
...
ListsplitString(String toSplit, String delimiter)
Split a String at the first occurrence of the delimiter.
if (!hasLength(toSplit) || !hasLength(delimiter)) {
    return Collections.emptyList();
return Arrays.asList(toSplit.split(delimiter));
ListsplitStringList(String strList, String delimit)
Convert a String into a list of String
ArrayList<String> list = new ArrayList<>();
if (strList != null && !strList.isEmpty()) {
    list.addAll(Arrays.asList(strList.split(delimit)));
return list;
StringsplitStringUsingDelimiter(String name, String delimiter)
split String Using Delimiter
return splitStringUsingDelimiter(name, delimiter, false);
String[]splitText(String text, String delimiter)
Splits the specified text by the specified delimiter.
if (text == null) {
    return new String[] {};
text = text.trim();
if (text.equals("")) {
    return new String[] {};
List<String> list = new ArrayList<String>();
...
String[]splitToArray(String stringToSplit, String delimitter, boolean trim)
split To Array
if (stringToSplit == null) {
    return new String[] {};
if (delimitter == null) {
    throw new IllegalArgumentException();
StringTokenizer tokenizer = new StringTokenizer(stringToSplit, delimitter, false);
int count = tokenizer.countTokens();
...