Here you can find the source of getSymbolSplitString(Collection> collection, String symbol)
Parameter | Description |
---|---|
collection | a parameter |
symbol | a parameter |
public static String getSymbolSplitString(Collection<?> collection, String symbol)
//package com.java2s; /**/* w w w . j a v a 2s . c o m*/ * The Clican-Pluto software suit is Copyright 2009, Clican Company * and individual contributors, and is licensed under the GNU LGPL. * * @author clican * */ import java.util.Collection; public class Main { /** * Return a string split by the symbol. * * @param collection * @param symbol * @return the result is combined by collection and symbol */ public static String getSymbolSplitString(Collection<?> collection, String symbol) { return getSymbolSplitString(collection.toArray(), symbol); } /** * * Return a string split by the symbol. * * @param array * @param symbol * @return the result is combined by array and symbol */ public static String getSymbolSplitString(Object[] array, String symbol) { if (array == null || array.length == 0) { return null; } StringBuffer buffer = new StringBuffer(); for (int i = 0; i < array.length; i++) { buffer.append(array[i]); if (i != array.length - 1) { buffer.append(symbol); } } return buffer.toString(); } }