欧美一区二区三区,国内熟女精品熟女A片视频小说,日本av网,小鲜肉男男GAY做受XXX网站

spring里面list怎么轉成string

錢瀠龍2年前17瀏覽0評論

spring里面list怎么轉成string?

應該問的是java里面如果將list轉成string才對哦

方法1:

public String listToString(List list,

char separator) {

StringBuilder sb = new StringBuilder();

for (int i = 0; i < list.size(); i++) {

sb.append(list.get(i)).append(separator);

}

return sb.toString().substring(0,sb.toString().length()-1);

}

方法2:

public String listToString(List list, char separator) {

StringBuilder sb = new StringBuilder();

for (int i = 0; i < list.size(); i++) {

if (i == list.size() - 1) {

sb.append(list.get(i));

} else {

sb.append(list.get(i));

sb.append(separator);

}

}

return sb.toString();

java 取list值,spring里面list怎么轉成string