Java Utililty Methods String Split by Delimiter

List of utility methods to do String Split by Delimiter

Description

The list of methods to do String Split by Delimiter are organized into topic(s).

Method

String[]SplitAt(String str, String delimiter)
Splits a string by a delimiter.
if (delimiter == null) {
    throw new NullPointerException("delimiter");
if (delimiter.length() == 0) {
    throw new IllegalArgumentException("delimiter is empty.");
if (((str) == null || (str).length() == 0)) {
    return new String[] { "" };
...
ListsplitByStr(String s, String delim)
split By Str
if (isEmpty(s))
    return Collections.emptyList();
ArrayList<String> tokens = new ArrayList<String>();
int i = 0;
while (i < s.length()) {
    int j = s.indexOf(delim, i);
    if (j == -1)
        break;
...
String[]splitChars(String str, String delimiters)
split Chars
if (str == null)
    return null;
List<String> results = new ArrayList<String>();
int lastpos = 0;
for (int i = 0, len = str.length(); i < len; i++) {
    char c = str.charAt(i);
    if (delimiters.indexOf(c) != -1) {
        results.add(str.substring(lastpos, i));
...
ListsplitFast(String text, char delim)
split Fast
List<String> result = new ArrayList<String>();
String s = text;
while (!s.isEmpty()) {
    int pos = s.indexOf(delim);
    if (pos == -1) {
        result.add(s);
        break;
    } else {
...
String[]splitForChar(final String string, final char delimiter)
split For Char
final char[] array = string.toCharArray();
final StringBuilder buffer = new StringBuilder((array.length >> 1) == 0 ? 1 : array.length >> 1);
final List<String> tokens = new ArrayList<String>(10);
for (final char curChar : array) {
    if (curChar == delimiter) {
        if (buffer.length() != 0) {
            tokens.add(buffer.toString());
            buffer.setLength(0);
...
ListsplitHtmlTagKeepDelimiter(String tag, String input)
split Html Tag Keep Delimiter
return splitHtmlTagKeepDelimiter(tag, 100, input);
ListsplitKeepDelimiter(String delimiter, String input)
split Keep Delimiter
return Arrays.asList(input.split(
        "(?i)" 
                + "((?<="
                + delimiter
                + ")|(?="
                + delimiter
                + "))"
));
...
ListsplitList(String data, String delims)
split List
if ((data == null) || (delims == null))
    return Collections.EMPTY_LIST;
ArrayList rc = new ArrayList();
StringBuffer buf = new StringBuffer();
boolean accumulate = false;
for (int i = 0; i < data.length(); i++) { 
    char ch = data.charAt(i);
    if (delims.indexOf(ch) >= 0) { 
...
ListsplitNestedString(String params, String delimStr, int numLeft, int numRight)
Splits a string, returning the string separated by the delimiter, with only the numLeft and numRight taken from the appropriate sides
ArrayList<String> args = new ArrayList<String>(numLeft);
ArrayList<String> endArgs = new ArrayList<String>(numRight);
int startIndex, endIndex;
startIndex = 0;
endIndex = 0;
for (int i = 0; i < numLeft; i++) {
    endIndex = params.indexOf(delimStr, startIndex);
    if (endIndex == -1)
...
String[]splitNoCoalesce(String s, char delimiter)
Exactly like splitNoCoalesce(s, Character.toString(delimiter))
return splitNoCoalesce(s, Character.toString(delimiter));