List转换字符串

1.使用StringUtils工具类
public String listToString(List list, char separator) {  
String urn = org.apache.commons.lang.StringUtils.join(list.toArray(),separator);  
}  

2.拼写字符串
 public String listToString(List list, char separator) {  
StringBuilder sb = new StringBuilder();  
for (int i = 0; i < list.size(); i++) {  
    sb.append(list.get(i)).append(separator);  
}  
return sb.toString().substring(0,sb.toString().length()-1);  
   }  

你可能感兴趣的:(java)