public static java.lang.String | arrayToCommaList(java.lang.Object[] array)Format an array of Object as a list with commas,
like "apples, oranges, and bananas");
StringBuffer sb = new StringBuffer();
for (int i=0; i<array.length; i++) {
if (i > 0 && i < array.length - 1) {
sb.append(',");
}
if (i > 0) {
sb.append(' ");
}
if (i==(array.length-1)) {
sb.append("and ");
}
sb.append(array[i]);
}
return sb.toString();
|