Android String Array Join join(String delimiter, String[] array)

Here you can find the source of join(String delimiter, String[] array)

Description

join

Declaration

public static String join(String delimiter, String[] array) 

Method Source Code

//package com.java2s;

public class Main {
    public static String join(String delimiter, String[] array) {
        StringBuilder stringBuilder = new StringBuilder();
        int aLen = array != null ? array.length : -1;
        if (array != null && aLen > 1) {
            stringBuilder.append(array[0]).append(delimiter);
            for (int i = 1; i < aLen - 1; i++) {
                stringBuilder.append(array[i]).append(delimiter);
            }// w  w  w . ja  v a2 s. com
            return stringBuilder.append(array[aLen - 1]).toString();
        } else if (array != null && aLen == 1) {
            return stringBuilder.append(array[0]).toString();
        }
        return stringBuilder.toString();
    }
}

Related

  1. join(int[] arr, String delimiter)
  2. join(String[] parts, String delimiter)
  3. join(String delimiter, Object... chunks)
  4. join(String separator, Object... texts)
  5. join(String[] track)
  6. join(String[] strArray, String separator)
  7. join(String[] array, String separator)
  8. arrayToStr(String[] array)
  9. arrayToStr(String[] array, String delim)