Hundreds of features to explore
Games made in Construct
Your questions answered
Popular & trusted by schools and Universities world-wide
Construct 3 runs in the browser & works offline
Students do not need accounts with us
Our educational partners
Free education resources to use in the classroom
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
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"
int("string") != 0.
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]
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.