SoFunction
Updated on 2025-03-01

Code to replace multiple commas with one comma in js


function dostr(str){
str=trim(str);
var strarry=unique((","));
str=(",");
str=(/,/ig,",");
str=(/[^0-9,]*/ig,"");
str=(new RegExp(',+',"gm"),',');
if ((0,1)==',') str=(1);
var reg=/,$/gi;
str=(reg,"");
return str;
}