O'Reilly logo

Learning WML, and WMLScript by Martin Frost

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

isFloat — Test whether a string can be parsed as a floating-point value

Usage

Lang.isFloat(str)

str : String

Description

Returns true or false, depending on whether str can be parsed as a floating-point value by Lang.parseFloat( ).

Returns invalid if str can’t be converted to a string or if the interpreter doesn’t support floating-point operations.

Examples

Lang.isFloat("123.456")

returns Boolean true

Lang.isFloat("17")

returns Boolean true

Lang.isFloat(" -7.2 C")

returns Boolean true

Lang.isFloat(" 55.3 mph")

returns Boolean true

Lang.isFloat("6e+3")

returns Boolean true

Lang.isFloat(" .3")

returns Boolean true

Lang.isFloat("foo")

returns Boolean false

Lang.isFloat(false)

returns Boolean false

Lang.isFloat(invalid)

returns invalid

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required