Here you can find the source of joinString(List array, String symbol)
public static String joinString(List array, String symbol)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static String joinString(List array, String symbol) { String result = ""; if (array != null) { for (int i = 0; i < array.size(); i++) { String temp = array.get(i).toString(); if (temp != null && temp.trim().length() > 0) result += (temp + symbol); }// w w w . jav a2 s . com if (result.length() > 1) result = result.substring(0, result.length() - 1); } return result; } public static String joinString(String[] array, String symbol) { String result = ""; if (array != null) { for (int i = 0; i < array.length; i++) { String temp = array[i]; if (temp != null && temp.trim().length() > 0) result += (temp + symbol); } if (result.length() > 1) result = result.substring(0, result.length() - 1); } return result; } }