Java Array to String arrayToString(String[] strs, String separator)

Here you can find the source of arrayToString(String[] strs, String separator)

Description

array To String

License

Open Source License

Declaration

public static String arrayToString(String[] strs, String separator) 

Method Source Code

//package com.java2s;

public class Main {
    public static final String DEFAULT_SEPARATOR = ",";

    public static String arrayToString(String[] strs, String separator) {
        if (null == separator || "".equalsIgnoreCase(separator)) {
            separator = DEFAULT_SEPARATOR;

        }/*from w w w.  ja  v  a  2 s .com*/

        if (strs.length == 0) {
            return "";
        }
        StringBuffer sbuf = new StringBuffer();
        sbuf.append(strs[0]);
        for (int idx = 1; idx < strs.length; idx++) {

            sbuf.append(separator);
            sbuf.append(strs[idx]);
        }
        return sbuf.toString();
    }
}

Related

  1. arrayToString(String[] stringArray)
  2. arrayToString(String[] stringArray)
  3. arrayToString(String[] strings)
  4. arrayToString(String[] strs)
  5. arrayToString(String[] strs)
  6. arrayToString(String[] theArray)
  7. ArrayToString(String[] values)
  8. arrayToString(String[] values)
  9. arrayToString(String[] values)