CHR$ function

Purpose: CHR$ returns a string which contains the character[s] corresponding to the ASCII code integer parameter[s] which must have a value between 0 and 255. Up to 10 comma separated ASCII code integers can form the function parameter list.


Syntax:

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

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 10 comma separated ASCII code integers can form the ASCode1 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 ten integer optional arguments. CHR$ is a function complementary to ASC. ASC returns the ASCII integer value when given a character argument.

BCX Console Sample Programs using CHR$ function.

S05.bas S16.bas, S41.bas, S42.bas, S53.bas, S54.bas, S66.bas, S82.bas, S103.bas, S108.bas, S110.bas, S113.bas, S119.bas, S128.bas, S132.bas