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

ListsplitForIndexMatching(String string)
Split so that we can create multiple WildcardQuery.
int len = string.length();
if (len == 0) {
    return new ArrayList<>(0);
ArrayList<String> ret = new ArrayList<String>();
int last = 0;
char c = 0;
for (int i = 0; i < len; i++) {
...
ListsplitGenericIfNeeded(String name)
split Generic If Needed
List<String> result = new ArrayList<>();
if (name.contains("<")) {
    result.add(name.substring(0, name.indexOf("<")).trim());
    for (String item : Arrays.asList(name.substring(name.indexOf("<") + 1, name.indexOf(">")).split(","))) {
        result.add(item.trim());
} else {
    result.add(name);
...
IteratorsplitHelperName(String name)
This implementation is quite naive and should be possibly rewritten.
boolean literal = false;
boolean whitespace = false;
List<String> parts = new ArrayList<String>();
StringBuilder buffer = new StringBuilder();
for (int i = 0; i < name.length(); i++) {
    if (name.charAt(i) == ' ') {
        if (!whitespace) {
            if (!literal) {
...
ListsplitHistory(String history)
Split history string to history path using HISTORY_SEP as the separator
List<String> historyPath;
if (history.indexOf(HISTORY_SEP) == -1) {
    historyPath = Arrays.asList(history);
} else {
    historyPath = Arrays.asList(history.split(HISTORY_SEP_REGEX));
return historyPath;
ListsplitHTMLTags(final String string)
Splits the given string on spaces and certain embedded HTML tags.
if (!string.contains("<")) {
    return splitOnSpace(string);
String tempString = string;
tempString = replace(tempString, "<br>", " <br> ");
tempString = replace(tempString, "<ol>", " <ol> ");
tempString = replace(tempString, "</ol>", " </ol> ");
tempString = replace(tempString, "<ul>", " <ul> ");
...
MapsplitIdKeyConfig(String config)
split a keyid string into a map
HashMap<String, String> result = new HashMap<>();
String[] split = config.split(",");
for (String s : split) {
    if (s != null && !s.isEmpty()) {
        if (s.contains("@")) {
            String[] idSplit = s.split("@");
            if (idSplit.length > 1) {
                result.put(idSplit[1], idSplit[0]);
...
ListsplitInitialItems(final String text)
Split initial value text into items.
if (text == null || text.isEmpty())
    return null;
final List<String> items = new ArrayList<>();
int pos = 0;
while (pos < text.length()) {
    final char c = text.charAt(pos);
    if (c == ' ' || c == '\t')
        ++pos;
...
ArrayListsplitInput(String cliInput)
Splits the input of comma separated command line input and returns the results as an arraylist.
ArrayList<String> results = new ArrayList<String>();
if (cliInput == null || cliInput.trim().length() == 0) {
    return results;
for (String tempInput : cliInput.split(SEPARATOR)) {
    results.add(tempInput.trim());
return results;
...
int[]splitIntArray(final String iInput)
split Int Array
final List<String> items = split(iInput, RECORD_SEPARATOR);
final int[] values = new int[items.size()];
for (int i = 0; i < items.size(); ++i) {
    values[i] = Integer.parseInt(items.get(i).trim());
return values;
ListsplitIntegerFromString(String str)
split Integer From String
List<Integer> integerList = null;
if (null == str) {
    return integerList;
integerList = new ArrayList<Integer>();
String numDict = "0123456789";
char[] strChars = str.toCharArray();
StringBuffer sbuffer = new StringBuffer();
...