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

ListsplitToList(String valueString)
split To List
if (valueString == null) {
    return null;
ArrayList<String> result = new ArrayList<>();
splitToCollection(result, valueString);
return result;
ListsplitToTopLevelJsonObjects(String s)
split To Top Level Json Objects
List<String> jsonObjects = new ArrayList<String>(1000000);
int objectStartIndex = 0;
int objectStart = 0;
int objectEnd = 0;
int length = s.length();
for (int i = 0; i < length; i++) {
    switch (s.charAt(i)) {
    case '{':
...
String[]splitTypeArguments(final String nestedTypes)
Splits the provided string of nested types into separate top-level instances.
StringBuilder string = new StringBuilder(nestedTypes.replaceAll("\\s*", ""));
List<String> arguments = new ArrayList<String>();
while (string.length() > 0) {
    int nextComma = string.indexOf(",");
    int nextOpen = string.indexOf("<");
    if (nextComma == -1) {
        arguments.add(string.toString());
        string.setLength(0);
...
ListsplitTypes(String fullName)
split Types
String name = fullName;
List<String> result = new ArrayList<String>();
int openBrackets = 0;
int lastIndex = 0;
for (int i = 0; i < name.length(); i++) {
    if (name.charAt(i) == ',' && openBrackets == 0) {
        result.add(name.substring(0, i));
        lastIndex = i + 1;
...
String[]splitValues(String strValues)
split Values
if (strValues == null)
    return null;
List<String> values = new ArrayList<String>();
StringBuilder buffer = new StringBuilder();
for (int i = 0; i < strValues.length(); i++) {
    char c1 = strValues.charAt(i);
    switch (c1) {
    case DELIMITER:
...
ListsplitValues(String value)
split Values
List<String> values = new ArrayList<>();
for (String valueStr : value.split(",")) {
    values.add(valueStr.trim().toLowerCase());
return values;
int[]splitVersion(String version)
split Version
if (version == null || version.trim().equals("")) {
    return new int[0];
int endIndex = version.indexOf('-');
if (endIndex != -1) {
    version = version.substring(0, endIndex);
String[] versionsStr = version.split("\\.");
...
String[]splitWithoutEscaped(String str, String sep)
split Without Escaped
if (str == null || "".equals(str))
    return new String[] { "" };
List<String> list = new ArrayList<String>();
int end = indexSeparatorWithoutEscaped(str, sep);
while (end != -1) {
    list.add(str.substring(0, end));
    str = str.substring(end + sep.length());
    end = indexSeparatorWithoutEscaped(str, sep);
...
ListsplitWS(String s, boolean decode)
split WS
ArrayList<String> lst = new ArrayList<String>(2);
StringBuilder sb = new StringBuilder();
int pos = 0, end = s.length();
while (pos < end) {
    char ch = s.charAt(pos++);
    if (Character.isWhitespace(ch)) {
        if (sb.length() > 0) {
            lst.add(sb.toString());
...
Listsplitws(String val)
splitws
List toks = new ArrayList<String>(16);
int len = val.length();
while (len > 0 && val.charAt(len - 1) <= ' ')
    --len;
int x = 0;
while (x < len && val.charAt(x) <= ' ')
    ++x;
for (int i = x; i < len; ++i) {
...