[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'System' (#rtl)

chr

Convert byte value to character value

Declaration

Source position: systemh.inc line 762

function chr(

  b: Byte

):Char;

Description

Chr returns the character which has ASCII value X.

Historical note:

Originally, Pascal did not have typecasts and chr was a necessary function in order to do certain operations on ASCII values of characters. With the arrival of typecasting a generic approach became possible, making chr mostly obselete. However, chr is not considered deprecated and remains in wide use today.

Errors

None.

See also

Ord

  

Return ordinal value of an ordinal type.

Str

  

Convert a numerical value to a string.

Example

Program Example8;

{ Program to demonstrate the Chr function. }

begin
  Write (chr(10),chr(13)); { The same effect as Writeln; }
end.

The latest version of this document can be found at lazarus-ccr.sourceforge.net.