Is it a letter or number

Get help with using AutoHotkey and its commands and hotkeys
kaspian
Posts: 1
Joined: 25 Oct 2020, 10:57

Is it a letter or number

25 Oct 2020, 11:05

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.
Last edited by gregster on 09 Nov 2020, 19:19, edited 3 times in total.
Reason: Spam link removed.
User avatar
mikeyww
Posts: 5300
Joined: 09 Sep 2014, 18:38

Re: Is it a letter or number

25 Oct 2020, 11:23

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.
User avatar
Chunjee
Posts: 784
Joined: 18 Apr 2014, 19:05
GitHub: Chunjee

Re: Is it a letter or number

25 Oct 2020, 14:09

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.

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], hasantr, milkygirl90, MrCheeseman, RayB, TAC109, theon, XMCQCX and 39 guests