User`s manual

5-5
ASC
(string)
Returns the ASCII code (in decimal form) for the first character of the
specified string. The string-argument must be enclosed in parentheses. A
null-string argument will cause an error to occur.
100 PRINT ASC("A")
110 T$="AB": PRINT ASC(T$)
Lines 100 and 110 will print the same number.
The argument may be an expression involving string operators and functions:
200 PRINT ASC(RIGHT$(T$,1))
Refer to the ASCII Code Table, Appendix C. Note that the
ASCII
code for a
lower-case letter is equal to that letter's upper-case
ASCII
code plus 32. So
ASC may be used to convert upper-case values to lower-case values - useful in
case you have a line printer with lowercase capabilities and the proper
interfacing hardware /software).
ASC may also be used to create coding/decoding procedures (see example at
end of this chapter).
CHR$
(expression)
Performs the inverse of the ASC function: returns a one-character string
whose character has the specified ASCII, control or graphics code. The
argument may be any number from 0 to 255, or any variable expression with
a value in that range. Argument must be enclosed in parentheses.
100 PRINT CHR$(35)
prints a number-sign #
Using CHR$, you can even assign quote-marks (normally used as
string-delimiters) to strings. The ASCII code for quotes - is 34. So
A$=CHR$(34) assigns the value " to A$.
100 A$=CHR$(34)
110 PRINT"HE SAID, ";A$;"HELLO.";A$
RUN
HE SAID, "HELLO."
READY
>_