Java Utililty Methods String Split by Char

List of utility methods to do String Split by Char

Description

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

Method

ListsplitString(String str, char sep)
split String
List<String> res = new ArrayList<>();
int ptr = 0;
int len = str.length();
while (true) {
    if (ptr == len) {
        res.add("");
        break;
    int pos = str.indexOf(sep, ptr);
    if (pos == -1) {
        if (res.size() == 0) {
            res.add(str);
        } else {
            res.add(str.substring(ptr));
        break;
    res.add(str.substring(ptr, pos));
    ptr = pos + 1;
return res;
ListsplitString(String string, char ch)
split String
return splitString(string, ch, false);
ListsplitStringToChars(String str)
split String To Chars
List<String> split = new ArrayList<>(str.length());
for (int i = 0; i < str.length(); ++i)
    split.add(str.substring(i, i + 1));
return split;
String[]splitTrim(String str, String limitChar)
split Trim
if (str == null) {
    return null;
if ("".equals(str) || limitChar == null || "".equals(limitChar)) {
    return new String[] { str };
int limitLength = limitChar.length();
if (limitLength > str.length()) {
...
ListsplitWithEscape(String s, String splitChars)
split With Escape
if (splitChars == null) {
    splitChars = "";
List<String> result = new ArrayList<String>();
if (s == null) {
    return result;
boolean escaped = false;
...