String a = "a,b,c,d,e";
String b= "c,e,a";
StringBuilder sBuilder = new StringBuilder();
String String = "";
String[] array1 = a.split(",");
for (int i = 0; i < array1.length; i++) {
if (b.indexOf(array1[i]) == -1) {
sBuilder.append("'").append(array1[i]).append("'").append(",");
}
}
// 去除最后一个","
if (sBuilder.toString().endsWith(",")) {
String = sBuilder.toString().substring(0,sBuilder.length()-1);
}
System.out.println("sBuilder== "+String);
07-26
1184
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
11-05
5253
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
05-30