0
点赞
收藏
分享

微信扫一扫

Java 将List<String> 转为以逗号 ‘,’ 拼接的字符串


代码: 

public static void main(String[] args) {
List<String> mobileList=new ArrayList<>();
mobileList.add("110");
mobileList.add("120");
mobileList.add("119");
String mobileStr= StringUtils.strip(mobileList.toString(),"[]").replace(" ", "");
System.out.println(mobileStr);
}

结果:

Java 将List<String> 转为以逗号 ‘,’ 拼接的字符串_逗号

依赖:

<!-- commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
</dependency>

 

举报

相关推荐

0 条评论