1.去重字符串
var v = "1343、rere、1343、rerd";//需要去重的字符串
var arr = v.split('、');//["1343", "rere", "1343", "rerd"]
Array.prototype.unique = function(){
var res = [];
var json = {};
for(var i = 0; i < this.length;i++){
if(!json[this[i]]){
res.push(this[i]);
json[this[i]] = 1;
}
}
console.log(json);//{1343: 1, rere: 1, rerd: 1}
return res;
}
console.log(arr.unique());//["1343", "rere", "rerd"]
var qcsz = arr.unique().join("、");
console.log(qcsz);//1343、rere、rerd
var v = "1343、rere、1343、rerd";//需