Java Array Merge merge(String array[], String delimiter)

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

Description

merge

License

Apache License

Declaration

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

Method Source Code

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

public class Main {
    public static String merge(String array[], String delimiter) {
        if (array == null) {
            return null;
        }//from  w  w  w.j a v  a  2 s  .  c  o m

        StringBuffer sb = new StringBuffer();

        for (int i = 0; i < array.length; i++) {
            sb.append(array[i].trim());

            if ((i + 1) != array.length) {
                sb.append(delimiter);
            }
        }

        return sb.toString();
    }
}

Related

  1. merge(int[] array1, int[] array2)
  2. merge(int[] x1, int[] x2)
  3. merge(int[]... arrs)
  4. merge(long[] theArray, long[] workSpace, int lowPtr, int highPtr, int upperBound)
  5. merge(Object[][] array1, Object[][] array2)
  6. merge(String[] array)
  7. merge(String[] array1, String[] array2)
  8. merge(String[] strArr1, String[] strArr2)
  9. merge(String[] strArray)