其他分享
首页 > 其他分享> > List 转字符串后去掉前后 [ ]

List 转字符串后去掉前后 [ ]

作者:互联网

第一种

List<String> list = Arrays.asList("a","b","c");
//注意防止空指针
System.out.println(StringUtils.strip(list.toString(),"[]"));

第二种

List<String> list = Arrays.asList("a","b","c");
System.out.println(Joiner.on(",").skipNulls().join(list));
 

标签:Arrays,List,list,System,println,字符串,去掉,out
来源: https://www.cnblogs.com/liftsail/p/16539560.html