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(String[] array, char delimiter)
implode the given array
StringBuilder sb = new StringBuilder();
for (String s : array) {
    sb.append(s).append(delimiter);
return (sb.length() == 0) ? ("") : (sb.substring(0, sb.length() - 1));
Stringimplode(String[] array, String glue)
implode
String out = "";
if (array.length == 0) {
    return out;
for (Object part : array) {
    out = out + part + glue;
out = out.substring(0, out.length() - glue.length());
...
Stringimplode(String[] array, String separator)
implode
if (array.length == 0) {
    return "";
StringBuilder buffer = new StringBuilder();
for (String str : array) {
    buffer.append(separator);
    buffer.append(str);
return buffer.substring(separator.length()).trim();
Stringimplode(String[] array, String separator)
Connects all elements of array to a string.
return implode(array, separator, 0, array.length, false);
Stringimplode(String[] data, String delimiter)
Concats the String[] array data to a single String, using the specified delimiter as the glue.
StringBuilder sb = new StringBuilder();
for (int i = 0; i < data.length; i++) {
    if (i != 0) {
        sb.append(delimiter);
    sb.append(data[i]);
return sb.toString();
...
Stringimplode(String[] input)
implode
String result;
if (input.length == 0) {
    result = "";
} else {
    StringBuffer sb = new StringBuffer();
    sb.append(input[0]);
    for (int i = 1; i < input.length; i++) {
        sb.append(",");
...
Stringimplode(String[] segments, String delimiter)
Construct a single string from an array of strings, gluing them together with the specified delimiter.
String implodedString;
if (segments.length == 0) {
    implodedString = "";
} else {
    StringBuffer sb = new StringBuffer();
    sb.append(segments[0]);
    for (int i = 1; i < segments.length; i++) {
        if (segments[i] != null && !segments[i].isEmpty()) {
...
Stringimplode(String[] strings, String delimiter)
implode
StringBuilder sb = new StringBuilder();
for (int i = 0; i < strings.length - 1; i++) {
    sb.append(strings[i]).append(delimiter);
if (strings.length > 0) {
    sb.append(strings[strings.length - 1]);
return sb.toString();
...
Stringimplode(String[] stringsArr, String glue)
Concatenate strings of given array glued by given delimiter
String out = "";
for (int i = 0; i < stringsArr.length; i++) {
    out += (i != 0 ? glue : "") + stringsArr[i];
return out;
voidimplode(StringBuilder sbuf, Object[] data, String separator)
performs some rudimentary trimming of some text that is assumed to contain an sql statement Given an input string, let L be the text before the first \n or \r, with any whitespace removed from the beginning or end.
for (int i = 0; i < data.length; i++) {
    if (i > 0)
        sbuf.append(separator);
    sbuf.append(data[i]);