number ( string text , boolean|default:false _toInteger , boolean|default:true _canBeNegative ) : number
Convert a string into a number. Returns 0 if no number data.
Reminder: never use the name of a function to name a variable (do not create a variable called number)
See also
signedNumberExample
console(number("502684,68")) //-> 502684.68
console(number("502684.68")) //-> 502684.68
console(number("502684,68",true)) //-> 502684
console(number("-502684,68",false,true)) //-> -502684.68
console(number("-502684,68")) //-> 502684.68
Parameters
text
a text to transform into a number
_toInteger (optional)
if true, returns an integer, else return a float
_canBeNegative (optional)
is the generated number can be negative? Else a postive or null number will be returned.