南猫猫猫猫猫

导航

List<String>与逗号分隔的字符串互转

将逗号分隔的字符串转换为List

    List list = Arrays.asList(str.split(","));

    List list = Arrays.asList(StringUtils.split(str, ","));

将list转化为逗号分割的字符串

    String str = String.join(",", list);

    String str = StringUtils.json(list.toArray(), ",");    

将字符串中的字符替换

    String newStr = str.replace("需替换的字符", "目标字符");

posted on 2022-02-21 00:57  南猫猫猫猫猫  阅读(182)  评论(0编辑  收藏  举报