Java Utililty Methods String Implode

List of utility methods to do String Implode

Description

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

Method

Stringimplode(char delimiter, char escape, String... input)
Combine multiple Strings into one using the specified delimiter and the specified escape character.
boolean first = true;
StringBuilder result = new StringBuilder();
for (String str : input) {
    if (!first) {
        result.append(delimiter);
    } else {
        first = false;
    result.append(escape(str, escape, Character.toString(delimiter)));
return result.toString();
Stringimplode(final char separator, final Object... array)
Join array elements with a string.
return implode(array, separator);
Stringimplode(final String separator, final Iterable data)
implode
final StringBuilder sb = new StringBuilder();
for (String iterable : data) {
    sb.append(iterable).append(separator);
return sb.substring(0, sb.length() - separator.length());
Stringimplode(Object strarr[], String delim)
Same as implode(Iterable strarr, String delim), but taking an array instead of an Iterable object.
String res = "";
String del = "";
int i = 0;
for (Object c : strarr) {
    i++;
    if (i > 1)
        del = delim;
    res += (del + c.toString());
...
Stringimplode(Object[] data, String delimiter)
implode
String implodedString;
if (data.length == 0) {
    implodedString = EMPTY;
} else {
    StringBuffer sb = new StringBuffer();
    sb.append(data[0]);
    for (int i = 1; i < data.length; i++) {
        sb.append(delimiter);
...
Stringimplode(Object[] elements, String delimiter)
Combines an array to a string, using the specified delimiter.
StringBuffer buffer = new StringBuffer("");
for (int i = 0; i < elements.length - 1; i++) {
    buffer.append((String) elements[i] + delimiter);
buffer.append((String) elements[elements.length - 1]);
return buffer.toString();
Stringimplode(Object[] source, String delimiter)
implode
StringBuilder sb = new StringBuilder(source[0].toString());
for (int i = 1; i < source.length; i++) {
    if (source[i] == null)
        break;
    sb.append(delimiter);
    sb.append(source[i].toString());
return sb.toString();
...
Stringimplode(String delim, Object[] array)
Joins array elements in a String.
String asImplodedString;
if (array.length == 0) {
    asImplodedString = "";
} else {
    StringBuilder sb = new StringBuilder();
    sb.append(array[0]);
    for (int i = 1; i < array.length; i++) {
        sb.append(delim);
...
Stringimplode(String delimiter, String[] strings)
This method merges an array of strings to a single string
if (strings.length == 0) {
    return "";
} else {
    StringBuilder sb = new StringBuilder(strings[0]);
    for (int i = 1; i < strings.length; i++) {
        sb.append(delimiter).append(strings[i]);
    return sb.toString();
...
Stringimplode(String glue, String... parts)
implode
if ((glue == null) || (parts.length <= 0)) {
    return "";
String string = parts[0];
for (int i = 1; i < parts.length; i++) {
    string += glue + parts[i];
return string;
...