Here you can find the source of stringListToString(List
Parameter | Description |
---|---|
strList | - String List |
delim | - delimiter betwen each string |
public static String stringListToString(List<String> strList, String delim)
//package com.java2s; import java.util.List; public class Main { /*************************************************************************** * stringListToString -/*from w w w .j a v a 2 s . com*/ * @param strList - String List * @param delim - delimiter betwen each string * @return String **************************************************************************/ public static String stringListToString(List<String> strList, String delim) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < strList.size(); i++) { String s = (String) strList.get(i); if (i != 0) { sb.append(delim); } sb.append(s); } return sb.toString(); } }