I have a csv string like this \"1,2,3\" and want to be able to remove a desired value from it.
For example if I want to remove the value: 2, the output string should
or
var csv_remove_val = function(s, val, sep) { var sep = sep || ",", a = s.split(sep), val = ""+val, pos; while ((pos = a.indexOf(val)) >= 0) a.splice(pos, 1); return a.join(sep); }