Rpbasic-52 programming guide – Remote Processing BASIC 52 User Manual
Page 31

RPBASIC-52 PROGRAMMING GUIDE
2-12
CHR
Syntax:
C H R (expr)
C H R (string,position)
Where: expr = number from 0 to 255
string = string variable
position = 1 to length of string
Function:
Converts expr to ASCII character or prints string at position
Mode:
Comm and, run
Use:
PRINT CHR (65)
PRINT CH R($(0),1)
Cards:
All
D E S C R IP T I ON
CHR is a dual use ope rator, similar to AS C. One ve rsion converts a nu meric exp ression to an A SCII
character, allowing a variety of string manipulation operations. The second version uses CHR to print
individ ual ch aracte rs in an A SCII s tring. expr is a decimal number and truncates numbers from 0 through
65535 . There must be no s pace betw een C HR and th e left pa renthe ses or a n AR RA Y SIZ E erro r results .
Although expr can be any in teger, printable AS CII characte rs range from 20 H through 7E H (32 through 127).
The STR function may be used to m anipulate and print longer portions of strings.
RELATED
A S C , ST R , S TR I N G
ERRORS
B A D A R G U M E N T expr can't be truncated to an integer (0 through 65535)
ARRAY SIZE
space between CHR and left parentheses
EXAMPLE
10 STRING 200,20
20 $(1)="1234567890"
30 FOR N=64 TO 80
40 PRINT CHR(N),
50 NEXT
60 PRINT
70 FOR N=1 TO 9
80 PRINT CHR($(1),N),
90 NEXT
RUN
@ABCDEFGHIJKLMNOP
1234567890