6-3 Character Functions
(Location
[,
Number
of
characters
J)
MID$
Numeric expression Numeric expression
Function:
Fetches the specified number
of
characters from a specified location
of
the
exclusive character variable
($).
Parameter:
Location:
Number
of
characters:
Numeric expression. Values below the decimal point
are discarded.
1
S:
location<
101
Numeric expression. Values below the decimal point
are discarded.
1
S:
number
of
characters < 101.
When omitted, all characters after the specified location are fetched.
Explanation:
1) Fetches a specified number
of
characters from a specified location
of
the
exclusive character variable
($).
2) When the specified location
is
out
of
the character string, a null
is
obtained.
3) When the length
of
the character string after the specified location
is
smaller
than the specified number
of
characters, all the characters after the specified
location are fetched.
*MID$ can be abbreviated
as
MID.
Example:
10
$=~ABCDEFGHIJKLMNOPQRSTUVWXYZq
20
INPUT~location=q,M,~length=q,N
30
PRINT MID$<M,N>
40
GOTO
20
141