let oldRevedStr:string = "1,2,3,4,5";
let newRevedStr:string = "1,2,3,4,5,6,7";
let oldArr: Array<string> = oldRevedStr.split(",");
let newArr: Array<string> = newRevedStr.split(",");
for (let oldIndex: number = 0; oldIndex < oldArr.length; oldIndex++) {
for (let newIndex: number = 0; newIndex < newArr.length; newIndex++) {
if (oldArr[oldIndex] == newArr[newIndex]) {
newArr.splice(newIndex, 1);
break;
}
}
}
let endStr:string = newArr.toString();
console.log(endStr);//6,7
去重:去掉2个字符串相同内容
于 2022-11-11 23:57:58 首次发布