Here you can find the source of stringList2String(List
Parameter | Description |
---|---|
list | The list. |
separator | The separator. |
public static String stringList2String(List<String> list, String separator)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { /**/*from w w w. j a v a2 s . c om*/ * Return list of strings in a single string separated by a separator * string. * * @param list * The list. * @param separator * The separator. * @return The new String. */ public static String stringList2String(List<String> list, String separator) { String ret = ""; for (String s : list) { ret += s + separator; } return ret.substring(0, ret.length() - separator.length()); } }