Home / lang / chr 
Chr$
Syntax
Character = Chr$ ( Code AS Integer ) AS String
Character = Chr ( Code AS Integer ) AS String

Returns the character whose ASCII code is Code.

Be careful! Gambas uses the UTF-8 charset internally, so character code greater than 128 have not the meaning they have with a charset like ISO 8859-1. This is a problem especially if you have to process special characters of some languages like the German umlauts. You might want to convert the string into ASCII using the Conv$() function before processing it.

Errors

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

Examples

PRINT Chr$(65)

A

PUBLIC SUB Button1_Click()

  DIM X AS Integer

  FOR X = 32 TO 127
    PRINT Chr$(X);
  NEXT

END

See also

String Functions