I'm sorry, but I can't find working dot replacement on stackoverflow. Peoples ask about replacing
var str = '. 950.000.000, -';
str = str.replace(/\./gi, '');
alert(parseInt(str)); // yes, it works & will output correctly
But, it wouldn't works, when my 'str' var is : Rp. 950.000,- . It is currency format in my area, and i want to do math with it. I do this, and not work:
var str = 'Rp. 950.000, -';
str = str.replace(/\./gi, '');// i dont know, but the str values now is nothing
alert(parseInt(str)); // sure, it outputs nothing
I just want to replace all dots (so it will not bothers math operation, because dot is a decimal on number).
"Rp 950000, -"parseInton something that is not a number. Youralertwill printNaN. Just remove theparseIntif all you want is:Rp 950000, -1.234,56(or1,234.56) be treated?