Java Array Join join(Object[] array, String seperator)

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

Description

join

License

Apache License

Declaration

public static String join(Object[] array, String seperator) 

Method Source Code

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

import java.util.List;

public class Main {
    public static String join(List list, String seperator) {
        return join(list.toArray(new Object[0]), seperator);
    }/* w  ww.jav  a  2 s.  c  o  m*/

    public static String join(Object[] array, String seperator) {
        if (array == null)
            return null;
        StringBuffer result = new StringBuffer();
        for (int i = 0; i < array.length; i++) {
            result.append(array[i]);
            if (i != array.length - 1) {
                result.append(seperator);
            }
        }
        return result.toString();
    }
}

Related

  1. join(Object[] array, String separator)
  2. join(Object[] array, String separator)
  3. join(Object[] array, String separator)
  4. join(Object[] array, String separator)
  5. join(Object[] array, String separator)
  6. join(Object[] elements, CharSequence separator)
  7. join(Object[] elements, String glue)
  8. join(Object[] objects)
  9. join(Object[] parts, String delim)