5/Strings
"Without
string-handling capabilities, a computer
is
just
a super-powered
calculator." There's an element
of
truth in that exaggeration; the moreyou use the
string capabilities
of
ModelIII
BASIC,
the truer the statement will seem.
In
Model
III
BASIC
any valid variable name can be used to contain string values, by
the
DEFSTR
statement
or
byadding a type declaration character to the name.
And
each string can contain up to
255
characters.
Moreover,
you
can compare strings to alphabetize them,
for
example. You can take
strings apart
and
string them together (concatenate them). For background
materialto this chapter, see Chapter 1, "Variable Types"
and'
'Glossary",
and
Chapter4, DEFSTR.
Functions coveredin this chapter:
FRE (string)
INKEY$
LEN
ASC
CHR$
LEFT$
MID$
RIGHT$
STR$
STRING$
TIME$
VAL
NOTE:Whenever
string is given asafunction argument, you can use a string
expression
or
constant.
StringSpace
Fifty bytes
of
memory are set aside automaticallyto store strings.
If
you run out
of
string space, you will get an OS error and you should use the CLEAR n command to
save more space.
Note: CLEAR also sets variables to zero or null strings.
Tocalculate the space you'll need, multiply the amount
of
space each variable takes
(See
V
ARPTR)
by the number
of
string variables you are using, including temporary
variables.
Temporary variables are created during the calculation
of
string functions.
Thereforeeven
if
you have only a few short string variables assigned in your
program, you may run out
of
string space
if
you concatenate them several times.
5/1