Java Utililty Methods Array to Delimited String

List of utility methods to do Array to Delimited String

Description

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

Method

StringarrayToDelimitedString(Object[] arr, String delim)
Convert a String array into a delimited String (e.g.
if (arr == null || arr.length == 0) {
    return EMPTY;
if (arr.length == 1) {
    return (arr[0] == null) ? EMPTY : arr[0].toString();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < arr.length; i++) {
...
StringarrayToDelimitedString(String[] values, String delimiter)
array To Delimited String
StringBuffer str = new StringBuffer();
for (String val : values) {
    if (str.length() > 0) {
        str.append(delimiter);
    str.append(val);
return str.toString();
...
StringarrayToDelimitedString(T[] array, String left, String delimiter, String right)
array To Delimited String
return arrayToDelimitedString(array, 0, array.length, left, delimiter, right);
StringarrayToReadableString(String[] array)
array To Readable String
if ((array == null) || (array.length == 0)) {
    return "";
StringBuilder sb = new StringBuilder();
for (String s : array) {
    sb.append(", ");
    sb.append(s);
return sb.substring(2);
StringarrayToTabSeparatedString(final String[] values)
array To Tab Separated String
boolean isFirst = true;
StringBuilder str = new StringBuilder();
for (String mode : values) {
    if (!isFirst) {
        str.append("\t");
    str.append(mode);
    isFirst = false;
...
StringarrayToText(String[] values, String delimiter)
make a delimited text out of the array
StringBuilder sbf = new StringBuilder();
for (String value : values) {
    sbf.append(value).append(delimiter);
sbf.deleteCharAt(sbf.length() - 1);
return sbf.toString();