Lines 32-36
Link Here
|
32 |
var re = '\\d(?=(\\d{' + 3 + '})+' + '\\D' + ')', value = this.toFixed(decimal_digits); |
32 |
var re = '\\d(?=(\\d{' + 3 + '})+' + '\\D' + ')', value = this.toFixed(decimal_digits); |
33 |
return value.replace('.', decimal_point).replace(new RegExp(re, 'g'), '$&' + thousands_sep); |
33 |
return value.replace('.', decimal_point).replace(new RegExp(re, 'g'), '$&' + thousands_sep); |
34 |
} |
34 |
} |
|
|
35 |
String.prototype.unformat_price = function (params) { |
36 |
params = params == undefined ? {} : params; |
37 |
var thousands_sep = params.thousands_sep == undefined ? default_value.thousands_sep : params.thousands_sep, |
38 |
decimal_point = params.decimal_point == undefined ? default_value.decimal_point : params.decimal_point, |
39 |
//symbol = params.symbol == undefined ? '$' : params.symbol, // Not implemented yet |
40 |
decimal_digits = params.decimal_digits == undefined ? default_value.decimal_digits : params.decimal_digits; |
41 |
|
42 |
let value = this.valueOf(); |
43 |
value = value.replace(thousands_sep, '').replace(decimal_point, '.').replace(new RegExp('[^\\d.]', 'g'), ''); |
44 |
return Number(value).toFixed(decimal_digits); |
45 |
} |
46 |
|
35 |
</script> |
47 |
</script> |
36 |
<!-- / format-price.inc --> |
48 |
<!-- / format-price.inc --> |
37 |
- |
|
|