Caché Basic Reference
[Home] [Back] [Next]
InterSystems: The power behind what matters   

Returns the character corresponding to the specified ANSI character code.
The charcode argument is a decimal integer that identifies a character. For 8-bit characters, the value in charcode must evaluate to a positive integer in the range 0 to 255. For 16-bit characters, specify integers in the range 256 through 65534.
The Chr function takes an ANSI code and returns the corresponding character. The Asc function takes a character and returns the corresponding ANSI code.
Numbers from 0 to 31 are the same as standard, nonprintable ASCII codes. For example, Chr(10) returns a linefeed character.
The Caché Basic Chr function returns a single character. The corresponding ObjectScript $CHAR function can return multiple characters by specifying a comma-separated list of ASCII codes.
The following example uses the Chr function to return the character associated with the specified character code:
Println Chr(65)    ' Returns A.
Println Chr(97)    ' Returns a.
Println Chr(37)    ' Returns %.
Println Chr(62)    ' Returns >.
Println Chr(960)   ' Returns the symbol for pi.
See Also

Send us comments on this page
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA