public static void main(String[] args) {
List<String> list=new ArrayList();
list.add("110314");
list.add("113364");
StringBuilder sb = new StringBuilder();
for(int i = 0; i < list.size(); i++){
if (sb.length() > 0) {//该步即不会第一位有加号,也防止最后一位拼接加号!
sb.append("+");
}
sb.append(list.get(i));
}
//StringBuilder 转String
String result=sb.toString();
System.out.println(result);
}
网友评论