Hi,
How can we test if the content of a variable is numerical?
I occasionally get an error message, as sometime the variable I pass to an arithmetic function contains a string instead of a number.
Wicks
Testing a number
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Using VBScript IsNumeric function to test for numeric
Or you can try this:
[code]
VBSTART
VBEND
VBEval>IsNumeric("hello"),result
MessageModal>Is "hello" numeric ? %result%
VBEval>IsNumeric("55.7"),result
MessageModal>Is "55.7" numeric ? %result%
[/code]
[code]
VBSTART
VBEND
VBEval>IsNumeric("hello"),result
MessageModal>Is "hello" numeric ? %result%
VBEval>IsNumeric("55.7"),result
MessageModal>Is "55.7" numeric ? %result%
[/code]