JonaLin

字符串和数组互转

public static void main(String[] args) {
 List<String> list= new ArrayList();
        list.add("one");
        list.add("two");
        list.add("three");
        list.add("four");
        /**
         * 用->字符串将list内容连接
         * 结果:one->two->three->four,不用做二次处理
         */
        System.out.println(list);

        String value=list.join(",");
        System.out.println(value);

        //字符串转数组
        List<String> receivers = value.split(\';\')
        System.out.println(receivers);
}

结果如下:

 

分类:

技术点:

相关文章:

  • 2021-09-07
  • 2021-11-17
  • 2021-11-07
  • 2021-11-17
猜你喜欢
  • 2021-10-16
  • 2021-11-07
  • 2021-11-07
  • 2021-11-19
  • 2021-11-07
  • 2021-10-12
  • 2021-09-05
相关资源
相似解决方案