Chapter
10
I
BASIC
Keywords
STRING$
Function
STRING$(
number,character)
Returns
a
string containing the specified number
of
character.
Number
must be in the range
0
to
255.
Character
is a string
or
an ASCII code. If you use a string con-
stant,
you
must enclose it in quotation marks. All the characters
in the string have either the ASCII code, or the
first
letter
of
the
string specified.
STRING$ is useful
for
creating graphs
or
tables.
Examples:
B$
=
STRINGSC25,
“X”)
puts
a
string
of
25
“X”s
into
B$.
PRINT STRING$(50, 10)
prints
50
blank lines on the display, because
10
is the ASCII
code
for
a
line feed.
Sample
Program
1040
CLEAR
300
1050 INPUT “TYPE
IN
3 NUMBERS BETWEEN 33 AND
1060
CLS:
FOR
I
=
1
TO 4: PRINT STRING$(20, Nl):
1070
FOR
J
=
1
TO 2: PRINT STRINGs(40, N2): NEXT
1080 PRINT STRINGB(80, N3)
159”;
N1
,
N2, N3
NEXT
I
J
This program prints
3
strings. Each string has the character
corresponding to one
of
the ASCII codes provided.
323