Here you can find the source of convertArrayToString(Object[] array, String separator)
Parameter | Description |
---|---|
array | Array of objects |
separator | Separator |
public static String convertArrayToString(Object[] array, String separator)
//package com.java2s; /******************************************************************************* * Copyright (c) 2010-2013, Embraer S.A., Budapest University of Technology and Economics * 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 * * Contributors: //w w w .j a v a2s. com * Rodrigo Rizzi Starr, Lincoln Nascimento - initial API and implementation *******************************************************************************/ public class Main { /** * Converts an array of objects to a plain string with * a given separator * @param array Array of objects * @param separator Separator * @return array of objects converted to a plain string with * a given separator */ public static String convertArrayToString(Object[] array, String separator) { if (array == null) { return ""; } StringBuffer result = new StringBuffer(); for (int i = 0; i < array.length; i++) { result.append(array[i]); result.append(separator); } return result.toString(); } }