Java Array to Delimited String arrayToCommaDelimitedString(Object[] arr)

Here you can find the source of arrayToCommaDelimitedString(Object[] arr)

Description

array To Comma Delimited String

License

Apache License

Declaration

public static String arrayToCommaDelimitedString(Object[] arr) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String arrayToCommaDelimitedString(Object[] arr) {
        return arrayToDelimitedString(arr, ",");
    }//w  w  w . j  a  va2s .com

    public static String arrayToDelimitedString(Object[] arr, String delim) {
        if (arr == null) {
            return "";
        }
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < arr.length; i++) {
            if (i > 0)
                sb.append(delim);
            sb.append(arr[i]);
        }
        return sb.toString();
    }
}

Related

  1. arrayAsCommaSeperatedList(String... items)
  2. arrayAsString(final int[] _intArray)
  3. arrayToCommaDelimitedString(Object[] arr)
  4. arrayToCommaDelimitedString(Object[] strings)
  5. arrayToCommaSeparatedString(int[] array)
  6. arrayToCommaString(int[] array)
  7. arrayToCommaString(int[] array)