System.Chr

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function Chr(X: Byte): Char;

Properties

Type Visibility Source Unit Parent
function public System.pas System System

Description

Returns the character for a specified ASCII value.

Chr returns the character with the ordinal value (ASCII value) of the byte-type expression, X. The Byte parameter is an unsigned integer value large enough to represent a character. Word or UInt16 is also appropriate, because now that the string type is Unicode, a character is represented by two bytes.

Chr is an old Pascal standard function. For clarity, you can use a typecast such as Char() or AnsiChar() depending on the character type needed.

See Also

Code Examples