Java Utililty Methods Array to String

List of utility methods to do Array to String

Description

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

Method

StringarrayToString(Object[] objs, boolean stripPackageNames)
Creates a string representation of the given argument array.
return arrayToString(objs, stripPackageNames, null);
StringarrayToString(Object[] objs, String separator)
array To String
if (objs == null) {
    return "[null]";
StringBuffer result = new StringBuffer();
if (objs.length > 0) {
    result.append(objs[0] != null ? objs[0].toString() : objs[0]);
    for (int i = 1; i < objs.length; i++) {
        result.append(separator);
...
voidArrayToString(Object[] row, StringBuilder sbf)
Array To String
for (Object obj : row) {
    sbf.append(obj).append(',');
sbf.setCharAt(sbf.length() - 1, '\n');
StringarrayToString(Object[] subject)
Returns a String for the given String[] which is comma delimited.
String ret = "";
for (Object s : subject)
    ret += s.toString() + ",";
return ret.substring(0, (ret.length() - 1));
StringarrayToString(String array[], String separator)
array To String
return listToString(Arrays.asList(array), separator);
StringarrayToString(String format, double[] array)
array To String
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
pw.print("[");
if (array.length > 0)
    pw.printf(format, array[0]);
for (int i = 1; i < array.length; i++) {
    pw.print(", ");
    pw.printf(format, array[i]);
...
StringarrayToString(String in[])
Return array string values as blank separated string.
if (in == null)
    return null;
String ret = "";
for (int i = 0; i < in.length; i++) {
    ret += in[i] + " ";
return ret.trim();
StringarrayToString(String values[])
array To String
if (null == values)
    return "";
StringBuffer buffer = new StringBuffer(values.length);
for (int i = 0; i < values.length; i++)
    buffer.append(values[i]).append(",");
if (buffer.length() > 0)
    return buffer.toString().substring(0, buffer.length() - 1);
else
...
StringarrayToString(String[] a, String delim)
Concatenate an array of Strings into a single String.
StringBuffer buf = new StringBuffer();
for (int i = 0; i < a.length; i++) {
    buf.append(a[i]);
    if (i + 1 < a.length) {
        buf.append(delim);
return buf.toString();
...
StringarrayToString(String[] a, String separator)
array To String
StringBuffer result = new StringBuffer();
if (a.length > 0) {
    result.append(a[0]);
    for (int i = 1; i < a.length; i++) {
        result.append(separator);
        result.append(a[i]);
return result.toString();