Java String Array to String arrayStringtoString(final String[] arrayString)

Here you can find the source of arrayStringtoString(final String[] arrayString)

Description

Create a String object with all element of an array of String separated by double quotes and commas.

License

GNU General Public License

Parameter

Parameter Description
arrayString Array of string to concat

Return

a concatened String

Declaration

public static String arrayStringtoString(final String[] arrayString) 

Method Source Code

//package com.java2s;
/*/*from w  ww . ja v  a 2s.  c  om*/
 *                      Nividic development code
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  If you do not have a copy,
 * see:
 *
 *      http://www.gnu.org/copyleft/lesser.html
 *
 * Copyright for this code is held jointly by the microarray platform
 * of the ?cole Normale Sup?rieure and the individual authors.
 * These should be listed in @author doc comments.
 *
 * For more information on the Nividic project and its aims,
 * or to join the Nividic mailing list, visit the home page
 * at:
 *
 *      http://www.transcriptome.ens.fr/nividic
 *
 */

public class Main {
    /**
     * Create a String object with all element of an array of String separated by
     * double quotes and commas.
     * @param arrayString Array of string to concat
     * @return a concatened String
     */
    public static String arrayStringtoString(final String[] arrayString) {

        StringBuffer sb = new StringBuffer();

        if (arrayString != null) {

            for (int i = 0; i < arrayString.length; i++) {
                if (i > 0)
                    sb.append(",");
                sb.append('\"');
                sb.append(arrayString[i]);
                sb.append('\"');
            }

        }

        return sb.toString();
    }
}

Related

  1. array2string(String[] s)
  2. arrayAsString(String[] haystack)
  3. arrayAsString(String[] stringArray)
  4. ArrayCombine(String[] array, String delimiter)
  5. arrayStringToArrayInt(final String[] as)
  6. arrayStringToString(String[] args)