gpt4 book ai didi

java - 使用java中的ArrayUtils将字符串列表转换为单个字符串

转载 作者:行者123 更新时间:2023-12-02 14:45:08 25 4
gpt4 key购买 nike

我有以下代码

List<String> test = new ArrayList<String>();
test.add("one");
test.add("two");
test.add("three");

需要使用 Array Utils 在单个字符串中输出为 “一,二,三”。需要单行解决方案。

最佳答案

使用加入

String joined2 = String.join(",", test );

关于java - 使用java中的ArrayUtils将字符串列表转换为单个字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31623214/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com