这里只贴出主要运行的main方法, 大家自行创建包,类 

public static void main(String[] args) {

        String text1 = "ge1,ge2,ge3,ge4,ge5";

        String text2 = "ge1,ge4,ge3,ge5";
                            StringBuilder sb = new StringBuilder();
                            String[] strings = text1.split(",");
                            for (String s : strings) {
                                if (!text2.contains(s)) {
                                       sb.append(s + ","); 

                                }
                           }
  
                           String c = sb.substring(0, sb.length()).toString();
                           System.out.println("text1文本中text2没有的元素是:"+c);

 }

 

相关文章:

  • 2021-09-29
  • 2021-10-16
  • 2021-07-08
  • 2022-12-23
  • 2021-09-29
  • 2021-10-16
  • 2021-10-16
  • 2021-10-16
猜你喜欢
  • 2021-10-06
  • 2022-02-07
  • 2021-09-29
  • 2021-11-18
  • 2021-11-28
相关资源
相似解决方案