toSeeMyDream

(Java)怎么去掉字符串数组中重复的值?

        String fdbs = "WXB,WXA,FDA,WXB";
        String[] str = fdbs.split(",");
        Set set = new HashSet();
        for (int i = 0; i < str.length; i++) {
            set.add(str[i]);
        }
        str = (String[]) set.toArray(new String[0]);
        for (int i = 0; i < str.length; i++) {
            System.out.println(str[i]);
        }

 

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-01-16
  • 2021-07-16
  • 2021-10-26
  • 2022-12-23
  • 2022-12-23
  • 2022-01-01
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-01
  • 2022-01-01
  • 2021-12-28
  • 2022-12-23
  • 2021-07-19
  • 2022-12-23
相关资源
相似解决方案