JS删除字符串 var str="36,35,26,41,42,36,36,35,41,25,26," 字符串中的每个数字说不定会出现在哪,我想除去重复的。 要怎么做?要兼容FF的
------解决方案--------------------
JScript code
var str="36,35,26,41,42,36,36,35,41,25,26,";
var ret = [];
var re = str.split(',');
str.replace(/[^,]+/g, function($0, $1) {
(str.indexOf($0) == $1) && ret.push($0)
})
alert(ret)