Testing a number

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
wcks
Newbie
Posts: 5
Joined: Fri Oct 09, 2009 9:06 pm

Testing a number

Post by wcks » Tue Feb 16, 2010 11:53 am

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
Wcks

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Feb 16, 2010 12:04 pm

Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

wcks
Newbie
Posts: 5
Joined: Fri Oct 09, 2009 9:06 pm

Post by wcks » Tue Feb 16, 2010 12:34 pm

Thank you.
Wcks

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Using VBScript IsNumeric function to test for numeric

Post by adroege » Thu May 27, 2010 3:23 pm

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]

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts