Ord

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

Number := Ord(String)

Parameters

String

Type: String

The string whose ordinal value is retrieved.

Return Value

Type: Integer

This function returns the ordinal value (numeric character code) of the first character in the specified string. If the string is empty, zero is returned. If the 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 0xFF (for ANSI) or 0 to 0xFFFF (for Unicode). See Unicode vs ANSI for details.

Related

Chr

Examples

#1: Both message boxes below show 116, because only the first character is considered.

MsgBox Ord("t") 
MsgBox Ord("test")