If var is [not] type

Checks whether a variable's contents are numeric, uppercase, etc.

if var is type
if var is not type

 

Parameters

var The variable name.
type See the remarks below.

 

Remarks

Supported Types:

integer True if var is non-empty and contains a purely numeric string without a decimal point. Leading and trailing whitespace is allowed. The string may start with a plus or minus sign.
float True if var is non-empty and contains a floating point number, that is, a purely numeric string containing a decimal point. Leading and trailing whitespace is allowed. The string may start with a plus sign, minus sign, or decimal point.
number True if var contains an integer or floating point number, as described above.
digit True if var is empty or contains only digits, which consist of the characters 0 through 9. Whitespace, plus signs, minus signs, and decimal points are not allowed.
xdigit Hexadecimal digit: Same as digit except the characters A through F (uppercase or lowercase) are also allowed.
alpha True if var is empty or contains only alphabetic characters. False if there are any digits, whitespace, punctuation, or other non-alphabetic characters anywhere in the string. For example, if var contains a space followed by a letter, it is not considered to be alpha.
upper True if var is empty or contains only uppercase characters. False if there are any digits, whitespace, punctuation, or other non-uppercase characters anywhere in the string.
lower True if var is empty or contains only lowercase characters. False if there are any digits, whitespace, punctuation, or other non-lowercase characters anywhere in the string.
alnum Same as alpha except that digit characters are also allowed.
space True if var is empty or contains only whitespace, which consists of the following characters: space (%A_Space%), tab (%A_Tab% or `t), linefeed (`n), return (`r), vertical tab (`v), and formfeed (`f).
time

True if var contains a valid date-time stamp, which can be all or just the leading part of the YYYYMMDDHH24MISS format. For example, a 4-digit string such as 2004 is considered valid. Use StringLen to determine whether additional time components are present.

Years less than 1601 are not considered valid because the operating system generally does not support them. The maximum year considered valid is 9999.

The word DATE may be used as a substitute for the word TIME, with the same result.

Note: The operators "between", "is", "in", and "contains" are not supported in expressions.

 

Related

%A_YYYY%, SetFormat, FileGetTime, IfEqual, if var in/contains MatchList, if var between, StringLen, IfInString, StringUpper, EnvAdd, Blocks, Else

 

Example

if var is float
	MsgBox, %var% is a floating point number.
else if var is integer
	MsgBox, %var% is an integer.
if var is time
	MsgBox, %var% is also a valid date-time.