Java Array Join arrayJoin(String[] array, char with)

Here you can find the source of arrayJoin(String[] array, char with)

Description

array Join

License

Open Source License

Declaration

public static String arrayJoin(String[] array, char with) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String arrayJoin(String[] array, char with) {
        if (array == null || array.length == 0) {
            return "";
        }//from ww  w  .  java 2s .c om
        int len = array.length;
        StringBuilder sb = new StringBuilder(16 + len * 8);
        sb.append(array[0]);
        for (int i = 1; i < len; i++) {
            sb.append(with);
            sb.append(array[i]);
        }
        return sb.toString();
    }
}

Related

  1. arrayJoin(int[] a, int[] b)
  2. arrayJoin(String[] arr, String joinStr)
  3. arrayJoinToString(Object[] array, CharSequence delim)
  4. join(byte[]... bs)
  5. join(char sep, Object[] array)
  6. join(CharSequence separator, String[] strings)