Android String Array Join toString(String[] arr, String delimiter)

Here you can find the source of toString(String[] arr, String delimiter)

Description

to String

Parameter

Parameter Description
arr a parameter
delimiter a parameter

Declaration

public static String toString(String[] arr, String delimiter) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from  ww  w . j  a v  a2 s  .c  om
     * 
     * @param arr
     * @param delimiter
     * @return
     */
    public static String toString(String[] arr, String delimiter) {
        if (arr == null || arr.length == 0) {
            return "";
        }
        if (delimiter == null) {
            delimiter = ",";
        }
        StringBuffer result = new StringBuffer();
        result.append(arr[0]);
        for (int a = 1; a < arr.length; a++) {
            result.append(delimiter);
            result.append(arr[a]);
        }
        return result.toString();
    }
}

Related

  1. arrayToStr(String[] array)
  2. arrayToStr(String[] array, String delim)
  3. implode(String[] array)
  4. join(String[] array, String separator, boolean ignoreNull)
  5. join(String[] list, String sep)
  6. join(String[] strArray, char separator)