JavaScript
$u.s.toNum Function
Syntax
$u.s.toNum(str as string)
Arguments
- strstring
The string to convert to a number.
Description
Convert a string into a number. Non-numeric characters are stripped out. The default thousands separator is a comma and decimal separator is a period. However, you can specify the values to use by setting $u.decimal and $u.comma.
Example
var amountString = '$2,623.23'; var amountValue = $u.s.toNum(amountString); var discountValue = amountValue * .9; var amountEuropeanString = 'E2.623,23'; $u.decimal = ','; $u.comma = '.'; var amountValue = $u.s.toNum(amountEuropeanString);