Java Utililty Methods Array Implode

List of utility methods to do Array Implode

Description

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

Method

Stringimplode(String[] values, String separator, String beforeEach, String afterEach)
implode
StringBuffer result = new StringBuffer();
for (int i = 0; i < values.length; i++) {
    if (i > 0)
        result.append(separator);
    result.append(beforeEach);
    result.append(values[i]);
    result.append(afterEach);
return result.toString();
StringBuilderimplodeArray(Object[] array)
Convenience method for this#implodeArray(Object[], String) which uses a Constants#COMMA delimiter.
if (null == array) {
    return null;
return implodeArray(array, COMMA);
StringimplodeArray(Object[] items, String prefix, String suffix, String delimiter, String lastItemSuffix)
Glue together all items into one String.
if (items == null)
    throw new NullPointerException("items argument may not be null");
if (prefix == null)
    prefix = "";
if (suffix == null)
    suffix = "";
if (delimiter == null)
    delimiter = "";
...
StringimplodeArray(String[] inputArray, String glueString)
implode Array
String output = "";
if (inputArray.length > 0) {
    StringBuilder sb = new StringBuilder();
    sb.append(inputArray[0]);
    for (int i = 1; i < inputArray.length; i++) {
        sb.append(glueString);
        sb.append(inputArray[i]);
    output = sb.toString();
return output;
StringimplodeArray(String[] inputArray, String glueString, int start)
implode Array
if (inputArray.length > start) {
    String msg = "";
    boolean isFirst = true;
    for (int i = start; i < inputArray.length; i++) {
        if (!isFirst)
            msg += glueString;
        msg += inputArray[i];
        isFirst = false;
...
StringimplodeString(String[] strArray, String strDelim)
Returns a delimited string for an given array of string elements.
(Based on implode() in PHP)
String result = "";
for (String strValue : strArray)
    result += strValue + strDelim;
return result;
StringimplodeStringArray(Object[] pieces, String delim)
Implode an object array into a single string, delimited by a given delimiter
return implodeStringCollection(Arrays.asList(pieces), delim);