Page 1 of 1

Is it a letter or number

Posted: 25 Oct 2020, 11:05
by kaspian
Hallo,

can you please help me figure this out..

Code: Select all

string := "A7106952"
x := substr(string,1,1)
If (x is integer)
MsgBox %x% is a number!

Thanks you for answers.

Re: Is it a letter or number

Posted: 25 Oct 2020, 11:23
by mikeyww

Code: Select all

string := "A7106952"
x := substr(string,1,1)
If x is integer
 MsgBox %x% is a number!
Else MsgBox, Not!
See documentation for the syntax.

Re: Is it a letter or number

Posted: 25 Oct 2020, 14:09
by Chunjee
yes has to follow if Var is Type or if Var is not Type

(x is integer) will have unexpected results.


https://github.com/Shambles-Dev/AutoHotkey-Type_Checking/blob/master/IsType.ahk is a decent library that makes this more approachable.