some time we need get the actual number value from a well formated string. this example shows how we get the exact number value.
Lets consider we have a string its value like
$1,221.22
So the actual number is 1221.22 after eliminate the Dollar sign and comma. The javascript code is -
function getNumberFromCurrencyString(currencyString){
var result = currencyString.replace(‘$’,”); //remove dollar
result = result.replace(/\,/g,”); //remove comma
return result;
}
Advertisement
