Ord() - Syntax & Usage | AutoHotkey

AutoHotkey

Ord() [v1.1.21+]

Returns the ordinal value (numeric character code) of the first character in the specified string.

Number := Ord(String)

Parameters

String

The string whose ordinal value is retrieved.

Return Value

This function returns the ordinal value of String, or 0 if String is empty. If String begins with a Unicode supplementary character, this function returns the corresponding Unicode character code (a number between 0x10000 and 0x10FFFF). Otherwise it returns a value in the range 0 to 255 (for ANSI) or 0 to 0xFFFF (for Unicode). See Unicode vs ANSI for details.

Remarks

Apart from the Unicode supplementary character detection, this function is identical to Asc().

Related

Asc(), Chr()

Examples

; Both message boxes below show 116, because only the first character is considered.
MsgBox, % Ord("t") 
MsgBox, % Ord("test")