Chr$ Function
Returns the character specified by a numeric ASCII value.
Syntax
Chr$(number)
Parameters
- number
- Specify an integer expression between 1 and 255.
Return Values
Returns a character that corresponds with the specified ASCII code specified by the value of number.
Description
Chr$ returns a character string (1 character) having the ASCII value of the parameter number. When the number specified is outside of the range from 1 to 255, an error will occur.
See Also
Asc, InStr, Left$, Len, Mid$, Right$, Space$, Str$, Val
Chr$ Function Example
The following example declares a variable of type String and then assigns the string "ABC" to it. The Chr$ instruction is used to convert the numeric ASCII values into the characters "A", "B" and "C". The &H means the number following is represented in hexadecimal form. (&H41 means Hex 41)
Function Test
String temp$
temp$ = Chr$(&H41) + Chr$(&H42) + Chr$(&H43)
Print "The value of temp = ", temp$
Fend