2.5.3 ASC and CHR$
Format
Function
ASC (x$) Re
tu
rns
th
e ASCII code
for
the
first
x$:
String expression character in string expressi
on
x $.
CHR$ (x) Returns
the
letter
whose ASCII code
x: Numeric expression corresponds
to
the value
of
numeric
expression
X.
(No character
is
returned
if
the
value specified for x
is
less
then
33 ; therefore,
PRINT
11
~
"
or
PRINT
SPC
(I)
should be used
to
obtain spaces,
rather
than
CHR$ (32)).
!·
Example
X=ASC
(
11
A
11
)
Su
bst
itutes 65
(the
ASCII code for the
l
etter
A)
into
variable X.
Y =
ASC
C"
@]H
AR
P
")
Substitutes 83 (the ASCII code for S,
the first
letter
in the string
"SHARP")
into
variable X.
A$=CHR$ (65)
Assigns A,
the
letter
corresponding to
ASCII code 65,
to
string variable A$ .
This function can be used
to
display
characters which
cannot
be entered
from
the
keyboard
as follows.
PRINT
CHR$
(1
07) J
This displays
the
graphic character
EEl
.
Let's
see,
89
is
the
ASCII
code
for Y,
so
..
•
Note:
ASCII code
is
a standard code system which
is
frequently used with
computers
. This code uses
8
bit
numbers
to
represent
the
letters
of
the alphabet, numerals, and symbols such
as
the
dollar
sign
and
question
mark
.
The
full code set
is
presented in the table on page 154.
78
--------------------------------------------------------------------------