Chr Function

Returns a FixStr (String) value containing the character, associated with the specified character code.

Syntax

Chr[$]([charcode])

The optional charcode argument is a Long that identifies a character. If this argument is omitted, is a non-initialized variable, or Null, the function returns an empty string.
The Chr$ form returns String values. The Chr form returns FixStr values.

Remarks

Numbers from 0 – 31 are the same as standard, nonprintable ASCII codes. For example, Chr(10) returns a linefeed character. The normal range for charcode is 0 – 255. However, on DBCS systems, the actual range for charcode is -32768 to 65535.
If charcode is outside the 0-255 range, it will be adjusted to this range using the following formula: charcode Mod 256.

Example

Dim Char
Char = Chr(65)   ' Returns A.
Char = Chr(97)   ' Returns a.
Char = Chr(62)   ' Returns >.
Char = Chr(37)   ' Returns %.

 

See Also

Asc Function, Str Function, Type Conversion Functions