var input = 'a,b,b,said,said, t, u, ugly, ugly'; var splitted = input.split(','); var collector = {}; for (i = 0; i < splitted.length; i++) { key = splitted[i].replace(/^\s*/, "").replace(/\s*$/, ""); collector[key] = true; } var out = []; for (var key in collector) { out.push(key); } var output = out.join(','); alert(output);
Thank a lot :) :) :)
ReplyDelete