Monday, October 26, 2009

JavaScript String funtion Replace

var str="1,001,300.0";
str = str.replace(",",""); //will only replace the first comma

var x="1,2,25.8,1";
var y=x.replace(/,/g,''); //withGlobal Regular Expressionwill replace all comma