BASIC STRING FUNCTIONS
ASC
ASC returns the ASCII code
number
for a specified character.
Format:
ASC(arg)
where:
arg
is
a string constant. variable. or expression.
If the string
is
longer than one character. ASC retu rns the ASCII code for the
first character in the string. The returned
argument
is
a
number
and may be used
in
arithmetic
operations. ASCII codes are listed in
Appendix
A.
Examples:
?ASC("A")
Prints 65.
N=ASC(B$)
X=ASC("STR")
Prints the ASCII value of "s" (83).
CHR$
CHR$ returns the string representation
of
the specified ASCII code.
Format:
CHR$(arg)
where:
arg is a valid ASCII code
(see
Appendix
A)
in the
range
O<arg=:;255.
CHR$ can be used
to
specify characters than cannot be represented in
strings.
su
ch
as
the carriage return code and the double
quotation
mark.
Examples:
IF
C$=CHR$(13) GOTO 10
?CHR$(34);
"HOHOHO"
;CHR$(34)
LEFT$
Branches if
C$
is
a carriage return.
Prints the
eight
characters
"HOHOHO"
LEFT$ returns
the
leftmost
characters of a string.
Format:
LEFT$(arg.count)
where:
156
arg
count
is a string constant. variable. or expression.
is
a numeric constant. variable. or expression
specifying the
number
of
leftmost
characters
to
be returned. in the range
O<count~255.