Java Array to String arrayToString(String[] array)

Here you can find the source of arrayToString(String[] array)

Description

Append an array of Strings to a String separated by a path separator.

License

Open Source License

Parameter

Parameter Description
array An array of Strings.

Return

string which contains all indexes of a String array separated by a path separator.

Declaration

public static String arrayToString(String[] array) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * /*from   ww w  .ja  v  a2  s .  c  om*/
 * Contributors:
 *      Nokia Siemens Networks - initial implementation
 *      Petri Tuononen - Initial implementation
 *******************************************************************************/

public class Main {
    /**
     * Append an array of Strings to a String separated by a path separator.
     * 
     * @param array An array of Strings.
     * @return string which contains all indexes of
     * a String array separated by a path separator.
     */
    public static String arrayToString(String[] array) {
        StringBuffer sB = new StringBuffer();
        //if array isn't empty and doesn't contain an empty String 
        if (array.length > 0 /*&& !array[0].equals("")*/) {
            for (String i : array) {
                sB.append(i);
                sB.append(System.getProperty("path.separator")); //$NON-NLS-1$
            }
        }
        return sB.toString();
    }
}

Related

  1. arrayToString(String[] array)
  2. arrayToString(String[] array)
  3. arrayToString(String[] array)
  4. arrayToString(String[] array)
  5. arrayToString(String[] array)
  6. arrayToString(String[] array)
  7. arrayToString(String[] array)
  8. arrayToString(String[] array, int start, String delimiter)
  9. arrayToString(String[] array, String delim, boolean quotes)