WMLScript parseFloat() Function
The parseFloat() function returns a floating-point number defined by a string.
Parsing will end at the first character that cannot be parsed as a floating-point number.
Syntax
n = Lang.parseFloat(string)
Component | Description |
---|---|
n | Floating-point value returned from the function. |
string | A string. |
Example
var a = Lang.parseFloat("2345.14"); var b = Lang.parseFloat(" -4.45e2 Kg"); var c = Lang.parseFloat(" +4.45e2 Kg"); var d = Lang.parseFloat("-.3 C"); var e = Lang.parseFloat(" 300 ");
Result
a = 2345.14 b = -4.45e2 c = 4.45e2 d = -0.3 e = 300.0