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

String[]splitBreaks(String text)
Splits a String with HTML in it into paragrpahs, based on the <br> tags found.
String[] subs = text.split("<br>");
ArrayList<String> a = new ArrayList<>();
for (String sub : subs) {
    if (!sub.trim().isEmpty()) {
        a.add(sub);
return a.toArray(new String[0]);
...
String[]splitByTypeAndName(final String s)
Splits the specified string into a type, a name and the rest of the string.
final String[] parts = splitByType(s);
final String[] parts2 = parts[1].split("\\s+", 2);
return new String[] { parts[0], parts2[0], parts2.length == 2 ? parts2[1] : "" };
String[]splitCamelback(String s)
split Camelback
return s.split("(?<=[a-z])(?=[A-Z])");
ListsplitCQLStatements(String source)
Split a script containing one or more CQL statements (terminated by ;'s) into a list of individual statements.
String[] cqlStatements = source.split(";"); 
List<String> individualStatements = new ArrayList<String>();
if (cqlStatements.length > 0) {
    for (String cqlC : cqlStatements) {
        cqlC = cqlC.trim();
        if (!cqlC.endsWith(";")) { 
            cqlC += ";"; 
        individualStatements.add(cqlC);
return individualStatements;
String[]splitDateText(String text)
split Date Text
java.util.List<String> list = new ArrayList<String>();
final int n = text.length();
int i = 0;
int j = 0;
for (; i < n;) {
    int i0 = i;
    for (; i < n; i++) {
        char c = text.charAt(i);
...
ArrayListsplitDigits(long input)
Converts an integer into an Integer array that has individual digits
ArrayList<Integer> digits = new ArrayList<Integer>();
String digitsString = Long.toString(input);
for (int i = 0; i < digitsString.length(); i++) {
    String subStr = digitsString.substring(i, i + 1);
    digits.add(Integer.parseInt(subStr));
return digits;
String[]splitDomains(String domains)
split Domains
ArrayList<String> list = new ArrayList<String>();
int count = domains.length();
int start = -1;
for (int i = 0; i < count; ++i) {
    char c = domains.charAt(i);
    switch (c) {
    case '(':
        if (i == 0 || domains.charAt(i - 1) != 'a') {
...
ListsplitElements(String values)
Split a list of values.
final ArrayList<String> list = new ArrayList<String>();
try {
    if (values != null) {
        final String[] split = values.trim().split(DEFAULT_VALUE_SEPARATOR);
        if (split != null && split.length != 0) {
            for (final String value : split) {
                if (value != null) {
                    list.add(String.valueOf(value));
...
String[]splitEx(String str, String spilter)
split Ex
if (str == null) {
    return null;
if ((spilter == null) || (spilter.equals("")) || (str.length() < spilter.length())) {
    String[] t = { str };
    return t;
ArrayList al = new ArrayList();
...
String[]splitFields(String fieldsString, int minNum)
Utility to split a string on vertical bars into at least minNum pieces.
final String[] pieces = fieldsString.split("\\s*\\|\\s*");
return ensureNumFields(pieces, minNum);