Here you can find the source of joinList(String separater, List
Parameter | Description |
---|---|
separater | a parameter |
list | a parameter |
public static String joinList(String separater, List<String> list)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { /**/*from ww w . j ava 2 s .c o m*/ * Join a list of string together * * @param separater * @param list * @return the string */ public static String joinList(String separater, List<String> list) { String result = ""; for (int i = 0; i < list.size(); i++) { result = result + list.get(i) + separater; } if (!result.equals("")) { result = result.substring(0, result.length() - separater.length()); } return result; } }