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