2.5.2 LEFT$, MID$, and RIGHT$
The LEFT$, MID$, and RIGHT$ functions are used to extract character strings from the left end, right
end, or middle
of
a character expression.
Format
Example
X$: String expression
Function
Remarks
m and n: Numeric expressions
(when A$
= "ABCDEFG")
Returns
the
character B$= LEFT$ (A$, 2)
0~
n~
255
string consisting
of
the n
B
$._
1ABI
CD
EF
G
characters making
up
the
left
of
string expression
LEFT$ (X$,
n)
X$.
Substitutes 2 characters from
the left end
of
string variable
A$
into string varible
B$.
Thus,
B$
= "
AB
".
Returns
the
character
B$=MID$ (A$, 3, 3)
1
~m~
255
string consisting
of
the n
0~
n
~
255
characters making up the
B
$l
AB
IC
DEIF
G
n characters starting with
I
MID$ (X$, m, n)
the
mth
character in string Substitutes the 3 characters
expression X$.
starting
at
the
3rd character
in string variable
A$
into
string variable B$.
Returns
the
character
B$
= RIGHT$ (A$, 2)
0~
n~
255
string consisting
of
the n
ABCDE
IF
GI
characters making
up
the
B$l
right end
of
string ex-
I
RIGHT$ (X$, n)
pression X$.
Substitutes 2 characters
from
the
right end
of
string
variable A$ into string
varible B$.
Thus,
B$
= "FG".
----------------
--------------------------
--------------------~-------77