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(T[] array, String delim)
Based on implode() in PHP
String result = "";
for (T val : array) {
    result += val.toString() + delim;
if (!result.isEmpty()) {
    result = result.substring(0, result.length() - 1);
return result;
...
StringimplodeParams(Object[] params)
Converts and array of objects into a concatenated string Uses the "," character as the glue
return implodeParams(params, ",");
StringimplodeString(String[] strings, String seperator)
implode String
if (strings.length == 0) {
    return "";
} else {
    StringBuilder sb = new StringBuilder();
    sb.append(strings[0]);
    for (int i = 1; i < strings.length; i++) {
        sb.append(seperator);
        sb.append(strings[i]);
...
StringimplodeStringArray(String tokens[], String separator)
implode String Array
if (tokens.length == 0) {
    return "";
} else {
    StringBuffer sb = new StringBuffer();
    sb.append(tokens[0]);
    for (int i = 1; i < tokens.length; i++) {
        sb.append(separator);
        sb.append(tokens[i]);
...
StringimplodeStrings(String[] strings)
implode Strings
StringBuilder buffer = new StringBuilder();
for (int i = 0; i < strings.length; i++)
    buffer.append(strings[i]).append(',');
return buffer.toString();