Java Utililty Methods String Explode

List of utility methods to do String Explode

Description

The list of methods to do String Explode are organized into topic(s).

Method

Stringexplode(char separator, String[] input)
Combines an array of string into one string using the specified separator.
if (input == null)
    return null;
int count = 0;
StringBuffer out = new StringBuffer();
for (String word : input) {
    if (count++ > 0)
        out.append(separator);
    out.append(word);
...
String[]explode(final String str, final char delimiter, final int limit)
Splits a string at the specified delimiter into multiple substrings.
int count = 0;
int len = str.length();
int maxPos = 0; 
int countAtMaxPos = 0;
int upperLimit = limit - 1;
for (int pos = 0; pos < len; pos++) {
    if ((str.charAt(pos) == delimiter) && (limit == 0 || count < upperLimit)) {
        count++;
...
int[]explode(int clr)
explode
int[] explodedColors = new int[4];
for (int i = 0; i < 4; ++i)
    explodedColors[3 - i] = (clr >>> (i * 8)) & 0xFF;
return explodedColors;
Listexplode(String csv)
explode
final List<String> tokens = Arrays.asList(csv.trim().split("\\s*,\\s*"));
final List<String> result = new LinkedList<>();
for (String token : tokens) {
    if (token != null && !(token = token.trim()).isEmpty()) {
        result.add(token);
return result;
...
String[]explode(String data, String delim)
Operates a lot like the split function on String, but does not require the delimiter to be a regular expression (this does not matter much, except when dynamically loading the delim that may have regular expression special chars in it).
ArrayList<String> list = new ArrayList<String>();
StringBuffer sb = new StringBuffer(data);
boolean splitting = true;
int curpos = 0;
int delimpos = sb.indexOf(delim);
while (splitting) {
    if (delimpos >= 0) {
        list.add(sb.substring(curpos, delimpos));
...
String[]explode(String delim, String string)
This method splits a string without RegExes
return explode(delim, string, true);
Vectorexplode(String handleStr, String pointStr)
explode, separate string into a Vector
Vector v = new Vector();
int pos1, pos2;
try {
    if (handleStr.length() > 0) {
        pos1 = handleStr.indexOf(pointStr);
        pos2 = 0;
        while (pos1 != -1) {
            v.addElement(handleStr.substring(pos2, pos1));
...
String[]explode(String input, final char delimiter, final char escape, final int capacity)
Separate the components of a String that has been imploded using the specified delimiter and escape character
if (input == null) {
    return null;
StringBuilder seg = new StringBuilder();
ArrayList<String> result = new ArrayList<String>(capacity >= 0 ? capacity : 3);
boolean inEscape = false;
for (char chr : input.toCharArray()) {
    if (inEscape) {
...
Listexplode(String s, String delim)
Split a string on delimiter boundaries, and place each element into a List.
List<String> res = new ArrayList<String>();
if (s == null)
    return res;
String[] tokens = s.split(delim);
for (String token : tokens) {
    res.add(token);
return res;
...
Listexplode(String source, String deliminator)
Performs an 'explode' operation on the given source string.
ArrayList list = new ArrayList();
int i = find(source, deliminator);
while (i != -1) {
    list.add(source.substring(0, i));
    source = source.substring(i + deliminator.length());
    i = find(source, deliminator);
list.add(source);
...