Home › Forums › General XMetaL Discussion › Xmetal to check numeric value and alphanumeric value › Reply To: Xmetal to check numeric value and alphanumeric value
Reply to: Xmetal to check numeric value and alphanumeric valueNovember 23, 2012 at 6:52 pm
This isn't really an XMetaL or XFT question, it is more a JScript question (for which there are lots of different answers and resources). There is no “XMetaL JScript”. XMetaL uses the standard JScript engine installed with your copy of Windows, so you can use any of the resources that talk about using JScript on Windows (including Microsoft's documentation), the same engine used by Internet Explorer.
To start, JScript has a function called isNaN() that you can use to check for “non numbers”, however, it is quite simplistic and possibly won't meet your needs. Its main use is to check if something is a number before feeding it into some JScript math expression so that the expression won't fail. However, JScript can convert some things into numbers that you might not expect.
Your best bet is a regular expression. You might start here: