1. 程式人生 > >兩個字串之間進行去除重複的部分

兩個字串之間進行去除重複的部分

package test1;

public class demo10 {

public static void main(String[] args) {
String a = "8a8d8bbb547962c60154796772c40005,8a8d8bbb547962c601547967731a0007,";
String b = "8a8d8bbb547962c60154796772c40005,8a8d8bbb547962c601547967731a0007,8a8d8bbb547962c60154796773300009,";
String []  aa= a.split(",");
for(int i =0;i<aa.length;i++){
    b=b.replaceAll(aa[i]+",", "");  
}


System.out.println(b);

String str="Iama student, and I like sport.";
str=str.replace("am","was");
System.out.println(str);






}

}