Name
isInt — Test whether a string can be parsed as an integer
Usage
Lang.isInt(str)
: Stringstr
Description
Returns true
or false
,
depending on whether str
can be parsed as
an integer by Lang.parseInt( )
. Returns
invalid
if str
can’t be converted to a string.
Examples
Lang.isInt("17")
returns Boolean true
Lang.isInt("23.67")
returns Boolean true
Lang.isInt(" -63 percent")
returns Boolean true
Lang.isInt("+4inches")
returns Boolean true
Lang.isInt(true)
returns Boolean false
Lang.isInt(".3")
returns Boolean false
Lang.isInt("+")
returns Boolean false
Lang.isInt(invalid)
returns invalid
Get Learning WML, and WMLScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.