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

Object[]splitPartitionColStats(String key)
split Partition Col Stats
Object[] result = new Object[4];
String[] comps = key.split(delimit);
result[0] = comps[0];
result[1] = comps[1];
List<String> vals = new ArrayList<>();
for (int i = 2; i < comps.length - 2; i++) {
    vals.add(comps[i]);
result[2] = vals;
result[3] = comps[comps.length - 1];
return result;
ListsplitResponses(String text)
split Responses
List<String> responses = new ArrayList<String>();
int start = 0;
while (text.length() > 0) {
    final int i = text.indexOf('|', start);
    if (i < 0) {
        responses.add(text.replace("\\|", "|"));
        break;
    if (i > 0 && text.charAt(i - 1) == '\\') {
        start = i + 1;
    } else {
        responses.add(text.substring(0, i).replace("\\|", "|"));
        text = text.substring(i + 1);
        start = 0;
return responses;
ListsplitScopes(String aActivityPath)
Splits the activity path into a series of paths to each of its scopes - starting with the first parallel forEach scope.
LinkedList<String> list = new LinkedList<>();
int offset = -1;
int startFrom = aActivityPath.lastIndexOf('/', aActivityPath.indexOf("[instance()=")); 
while ((offset = aActivityPath.indexOf("/scope", startFrom)) != -1) 
    int endOfScopePath = aActivityPath.indexOf('/', offset + 1);
    if (endOfScopePath == -1) {
        endOfScopePath = aActivityPath.length();
...
ListsplitScriptToQueries(String script)
split Script To Queries
return new ArrayList<>(Arrays.asList(script.split(";")));
ListSplitSearchTerms(String strSearch)
Split Search Terms
List<String> l = new ArrayList<String>();
if (strSearch == null) {
    assert false;
    return l;
StringBuilder sbTerm = new StringBuilder();
boolean bQuoted = false;
for (int i = 0; i < strSearch.length(); ++i) {
...
ListsplitSelection(String selection)
Transform the string with comma separated values into a list
List<String> theList = new ArrayList<String>();
if (selection == null || "".equals(selection)) {
    return theList;
String[] elements = selection.split(",");
if (elements == null || elements.length == 0) {
    return theList;
for (int i = 0; i < elements.length; ++i) {
    theList.add(elements[i].trim());
return theList;
ListsplitSelectionAsInteger(String selection)
split Selection As Integer
return splitSelectionAsInteger(selection, ",");
ListsplitSemicolonString(String semicolonString)
split Semicolon String
List<String> stringList = new ArrayList<String>();
if (semicolonString != null && semicolonString.length() > 0) {
    String[] split = semicolonString.split(";");
    for (String val : split) {
        stringList.add(val.trim());
return stringList;
...
ListsplitSentence(String sentence)
split Sentence
List<String> result = new ArrayList();
StringBuilder sb = new StringBuilder();
for (char c : sentence.toCharArray()) {
    if (c == '\n') {
        if (sb.length() > 0) {
            result.add(sb.toString());
            sb = new StringBuilder();
    } else {
        sb.append(c);
if (sb.length() > 0)
    result.add(sb.toString());
return result;
ListsplitSimple(String split, String s)
Splits s into a List of Strings separated by split, which is not a regex.
return splitSimple(split, s, 4);