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

List>splitListToParts(final List list, final int times)
Splits the List to Parts to the specified times.
final List<List<T>> returnList = new ArrayList<>();
List<T> tmp = new ArrayList<>();
final Iterator<T> it = list.iterator();
int count = 0;
while (it.hasNext()) {
    if (count == times) {
        returnList.add(tmp);
        tmp = new ArrayList<>();
...
ListsplitLongUnicodeString(String message, List result)
split Long Unicode String
String firstTempString = null;
String secondTempString = null;
int indexToCut = 0;
firstTempString = message.substring(0, MAX_CHAR);
indexToCut = firstTempString.lastIndexOf(" ");
firstTempString = firstTempString.substring(0, indexToCut);
result.add(firstTempString);
secondTempString = message.substring(indexToCut + 1, message.length());
...
ListsplitMacros(String s)
This parses the given string with the following form.
List<String> tokens = new ArrayList<String>();
int idx1 = s.indexOf("${");
while (idx1 >= 0) {
    int idx2 = s.indexOf("}", idx1);
    if (idx2 < 0) {
        break;
    tokens.add(s.substring(0, idx1));
...
String[]splitManagedBean(String el)
split Managed Bean
String[] dim = el.trim().split("\\.");
if (!el.endsWith(".")) {
    return dim;
ArrayList list = new ArrayList();
for (int i = 0; i < dim.length; i++) {
    list.add(dim[i]);
list.add("");
return (String[]) list.toArray(new String[list.size()]);
ListsplitMultiMessageString(String multiMessageString, String messageSplitter)
Splits a multi-message string into several message strings.
ArrayList<String> messages = new ArrayList<String>();
if (multiMessageString.startsWith(messageSplitter)) {
    for (String message : multiMessageString.split(messageSplitter)) {
        if (!(message.trim()).isEmpty()) {
            messages.add(messageSplitter + message);
    return messages;
...
String[]splitName(String name)
split Name
if (false) {
    if (name.startsWith(STRING_DOT) || name.endsWith(STRING_DOT)) {
        throwIAEEmptyNameIn(name);
    final String[] parts = name.split(REGEX_DOT);
    for (String part : parts) {
        if (part.length() == 0) {
            throwIAEEmptyNameIn(name);
...
String[]splitNames(final String string)
Splits qualified names by dots.
if (string.indexOf('"') == -1) {
    return string.split("\\.");
} else {
    final List<String> strings = new ArrayList<String>(2);
    int startPos = 0;
    while (true) {
        if (string.charAt(startPos) == '"') {
            final int endPos = string.indexOf('"', startPos + 1);
...
String[]splitObjectString(String str)
split Object String
List<String> ret2 = new ArrayList<String>();
int i;
char chr;
int ignoreValue = 0;
StringBuilder strBuf = new StringBuilder();
boolean ignStr = false;
for (i = 0; i < str.length(); i++) {
    chr = str.charAt(i);
...
ListsplitOgnl(String ognl)
Regular expression with repeating groups is a pain to get right and then nobody understands the reg exp afterwards.
List<String> methods = new ArrayList<String>();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < ognl.length(); i++) {
    char ch = ognl.charAt(i);
    if (i == 0 || (i == 1 && ognl.charAt(0) == '?') || (ch != '.' && ch != '?')) {
        sb.append(ch);
    } else {
        if (ch == '.') {
...
ListsplitOn(String toSplit, String splitter)
Splitters
List<String> result = new ArrayList<String>();
String processedToSplit = toSplit;
while (processedToSplit.contains(splitter)) {
    int firstOccurance = processedToSplit.indexOf(splitter);
    result.add(processedToSplit.substring(0, firstOccurance));
    processedToSplit = processedToSplit.substring(firstOccurance + splitter.length());
result.add(processedToSplit);
...