Java Array Join join(String[] array, String sep)

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

Description

join

License

Open Source License

Declaration

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

Method Source Code


//package com.java2s;
import java.util.Arrays;
import java.util.List;

public class Main {
    public static String join(String[] array, String sep) {
        return join(Arrays.asList(array), sep);
    }//w  ww .  j a v a  2s  . c o m

    public static String join(List<String> array, String sep) {
        StringBuilder sb = new StringBuilder();
        for (String arg : array) {
            if (sb.length() > 0) {
                sb.append(sep);
            }
            sb.append(arg);
        }
        return sb.toString();
    }
}

Related

  1. join(String[] array)
  2. join(String[] array, String delim)
  3. join(String[] array, String delimiter)
  4. join(String[] array, String delimiter)
  5. join(String[] array, String delimiter)
  6. join(String[] array, String separator)
  7. join(String[] array, String separator)
  8. join(String[] array, String separator)
  9. join(String[] arrayOfString)