Quick question: is there a function that return true when a given string is a number?
int("string") > 0 will work other than for zero. Otherwise you could use a regular expression.
For additional precision you could use
"string" = "0"
or
int("string") != 0.
Thanks guys
There is a function that returns true when a given string is NOT a number. It's not wrapped in any System expression so you'll have to use the Browser.ExecJS expression.
Browser.ExecJS("!isNaN(""" & yourVar & """);")[/code:1zas59qt] This will return 1 if yourVar is a valid javascript number.
Develop games in your browser. Powerful, performant & highly capable.
int(x) got one problem. If x < 1 (ie. 0.5), it will return 0, which is also the value to indicate that x is not a number. To remedy this, use float(x) instead.