lang • chr

Chr$

Character = Chr$ ( Code AS Integer ) AS String Character = Chr ( Code AS Integer ) AS String

Returns the character whose ASCII code is Code.

This function only deals with ASCII characters. If you need to create non-ASCII characters, like a German umlaut for example, you must use the String.Chr function.

Errors

Message

Description
Bad argument (20) Code is negative or greater than 255.

Examples

' This example prints the ASCII character code 65 which is uppercase A
Print Chr$(65)
A
' This example prints the characters whose ascii code
' is between 32 and 126

Dim X As Integer
For X = 32 To 126
  Print Chr$(X);
Next
 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
' This example illustrates the use of special character. Here Chr$(10)
' works like the newline command.

Print "This will print on line 1"; Chr$(10); "This will print on line 2"
This will print on line 1
This will print on line 2

See also