User`s manual

5-9
MID$
(string, p, n)
Returns a substring of
string
with length
n
and starting at position
p
. The
string name, length and starting position must be enclosed in parentheses.
string
may be a string constant or expression, and
n
and
p
may be numeric
expressions or constants. For example,
M 1 D$(L$,3,1)
refers to a
one-character string beginning with the 3rd character of L$.
Example Program:
The first three digits of a local phone number are sometimes called the
"exchange" of the number. This program looks at a complete phone number
(area code, exchange, last four digits) and picks out the exchange of that
number.
10
INPUT"AREA CODE AND NUMBERS (NO HYPHENS, PLEASE)";PH$
20
EX$=MID$(PH$,4,3)
30
PRINT"NUMBER IS IN THE ";EX$;" EXCHANGE."
If no argument is specified for the length n, the entire string beginning at
position p is returned.
RIGHT$
(string, n)
Returns the last n characters of
string
.
string
and n must be enclosed in
parentheses.
string
may be a string constant or variable, and n may be a
numerical constant or variable. If LEN(
string
) is less than or equal to n, the
entire
string
is returned.
RIGHT$(ST$,4) returns the last 4 characters of ST$.
STR$
(expression)
Converts a numeric expression or constant to a string. The numeric
expression or constant must be enclosed in parentheses. STR$(A), for
example, returns a string equal to the character representation of the value
of A. For example, if A=58.5, then STR$(A) equals the string " 58.5". (Note
that a leading blank is inserted before "58.5" to allow for the sign of A). While
arithmetic operations may be performed on A, only string operations and
functions may be performed on the string "58.5".
PRINT STR$(X) prints X without a trailing blank; PRINT X prints X with a
trailing blank.