Java Array to String arrayToString(Object[] subject)

Here you can find the source of arrayToString(Object[] subject)

Description

Returns a String for the given String[] which is comma delimited.

License

Open Source License

Parameter

Parameter Description
subject The String to parse.

Return

String[]

Declaration

public static final String arrayToString(Object[] subject) 

Method Source Code

//package com.java2s;
/**//w w w  .  ja  v a  2 s  .  c o m
 * <h1>CertDownload</h1>
 * <small>Copyright &copy;2014 Mike Duncan <a href="mailto:mike.duncan@waitwha.com">mike.duncan@waitwha.com</a>.</small><p />
 *
 * <pre>
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 * </pre>
 *
 * TODO Document this class/interface.
 *
 * @author Mike Duncan <mike.duncan@waitwha.com>
 * @version $Id$
 * @package com.waitwha.utils
 */

import java.io.PrintWriter;
import java.io.StringWriter;

public class Main {
    /**
     * Returns a String for the given String[] which is comma delimited. 
     * 
     * @param      subject      The String to parse.
     * @return   String[]
     */
    public static final String arrayToString(Object[] subject) {
        String ret = "";
        for (Object s : subject)
            ret += s.toString() + ",";

        return ret.substring(0, (ret.length() - 1));
    }

    public static final String toString(Exception e) {
        StringWriter writer = new StringWriter();
        e.printStackTrace(new PrintWriter(writer));

        return writer.toString();
    }
}

Related

  1. arrayToString(Object[] objs)
  2. arrayToString(Object[] objs)
  3. arrayToString(Object[] objs, boolean stripPackageNames)
  4. arrayToString(Object[] objs, String separator)
  5. ArrayToString(Object[] row, StringBuilder sbf)
  6. arrayToString(String array[], String separator)
  7. arrayToString(String format, double[] array)
  8. arrayToString(String in[])
  9. arrayToString(String values[])