Function Reference


StringIsInt

Checks if a string is an integer.

StringIsInt ( "string" )

Parameters

string The string to check.

Return Value

Success: 1.
Failure: 0 if string cannot be an integer.

Remarks

StringIsInt() also returns 1 for non-string integer expressions; however, StringIsInt() returns 0 for hexadecimal expressions such as "4ff0". The only punctuation allowed is either a plus or a minus at the beginning of the string.

Related

IsInt, StringIsDigit, StringIsFloat

Example

#include <MsgBoxConstants.au3>

MsgBox($MB_SYSTEMMODAL, "", "Is the string +42 an integer: " & StringIsInt("+42") & @CRLF & _ ; Returns 1, due to the + (plus) symbol being at the beginning of the string.
        "Is the string -00 an integer: " & StringIsInt("-00") & @CRLF & _ ; Returns 1, due to the - (minus) symbol being at the beginning of the string.
        "Is the string 1.0 an integer: " & StringIsInt("1.0") & @CRLF & _ ; Returns 0, due to the decimal point.
        "Is the number 1.0 an integer: " & StringIsInt(1.0) & @CRLF & _ ; Returns 1, due to the number to string conversion.
        "Is the string 1+2 an integer: " & StringIsInt("1+2") & @CRLF) ; Returns 0, as the + (plus) symbol is not at the beginning of the string.