把list转换为一个用逗号分隔的字符串
/** * 把list转换为一个用逗号分隔的字符串 */ public static String listToString(List<EntityDicAO> list) { String result = null; if (list != null && list.size() > 0) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < list.size(); i++) { if (i < list.size() - 1) { sb.append(list.get(i).getName() + ","); } else { sb.append(list.get(i).getName()); } } result = sb.toString(); } return result; }
随笔看心情