ordConvert the first byte of a string to a value between 0 and 255
&reftitle.description;
intordstringcharacter
Interprets the binary value of the first byte of
character as an unsigned integer between 0 and 255.
If the string is in a single-byte encoding, such as ASCII, ISO-8859, or Windows 1252, this is equivalent to returning the position of a character in the character set's mapping table. However, note that this function is not aware of any string encoding, and in particular will never identify a Unicode code point in a multi-byte encoding such as UTF-8 or UTF-16.
This function complements chr.
&reftitle.parameters;
character
A character.
&reftitle.returnvalues;
An integer between 0 and 255.
&reftitle.examples;
ord example
]]>
Examining the individual bytes of a UTF-8 string
]]>
&example.outputs;
Byte 0 of $str has value 240
Byte 1 of $str has value 159
Byte 2 of $str has value 144
Byte 3 of $str has value 152
&reftitle.seealso;
chrAn ASCII-tablemb_ordIntlChar::ord