CHR$ function

Purpose:

CHR$ returns a string which contains the character[s] corresponding to the Extended ASCII code integer argument[s] each of which must have a value between 0 and 255.

Up to 26 comma separated Extended ASCII code integers can form the function argument list. Use VCHR$ if more arguments are needed in one function call or else use multiple CHR$ statements.

Syntax:

RetStr = CHR$(ASCode1, [ASCode2, ... ASCode26])

Return Value:

  • Data type: STRING
    RetStr string which contains the character[s] corresponding to the ASCII code integer arguments[s].

Parameters:

  • Data type: INTEGER
    ASCode1 [OPTIONAL] parameter containing ASCII code integer[s]. Up to 26 comma separated ASCII code integers can form the CHR$ parameter argument list.

Example 1:

DIM str1$
str1$ = CHR$(66)
PRINT str1$;
str1$ = CHR$(67)
PRINT str1$;
str1$ = CHR$(88)
PRINT str1$

Result:

BCX

Example 2:

DIM str1$
str1$ = CHR$(66,67,88)
PRINT str1$

Result:

BCX

Remarks:

BCX's implementation allows up to twenty six integer optional arguments. CHR$ is a function complementary to ASC, which returns the ASCII integer value when given a character argument.

BCX Console Sample Programs using CHR$ function.