Java String Array to String arr2str(String[] arr, String sep)

Here you can find the source of arr2str(String[] arr, String sep)

Description

arrstr

License

Open Source License

Declaration

public static String arr2str(String[] arr, String sep) 

Method Source Code

//package com.java2s;

public class Main {

    public static String arr2str(String[] arr, String sep) {
        if (arr.length > 0) {
            StringBuffer sb = new StringBuffer();
            for (String s : arr) {
                sb.append(s).append(sep);
            }//from   w  ww .ja  v a  2  s . c  o  m
            return sb.toString().substring(0, sb.toString().lastIndexOf(sep));
        } else {
            return null;
        }
    }
}

Related

  1. argsToString(String separator, T... args)
  2. argsToString(String[] args)
  3. argsToString(String[] args, int start)
  4. argsToString(String[] args, int startFrom)
  5. arr2str(String[] arr)
  6. array2str(String[] array, String delim)
  7. array2str(String[] arrayname, int length)
  8. array2string(String array[])
  9. array2string(String[] s)