Home List转String,逗号分割
Post
Cancel

List转String,逗号分割

1
2
3
4
5
6
7
// 将List转化为逗号分割的字符串
String str = String.join(",", list);
String str = StringUtils.json(list.toArray(), ",");

// 将逗号分隔的字符串转换为List
List<String> list = Arrays.asList(str.split(","));
List<String> list = Arrays.asList(StringUtils.split(str, ","));
This post is licensed under CC BY 4.0 by the author.