PI1X Basic Programming Manual Ver. 1.10
23/156
Purpose
:
To retrieve a given number of characters from the left side of
the target string.
Syntax
:
A$ = LEFT$(Str$, N%)
Example
:
Str$ = "ABCDEFGHIJK"
PRINT LEFT$(Str$,3)
PRINT LEFT$("168IbB",3)
Description
:
A$
is a string variable to be assigned to the result.
Str$
may be a string variable, string expression, or string
constant.
N%
is a numeric expression.
If
N%
is larger than the length of
Str$
,the
Str$
is returned.
If
N%
is zero, the null string is returned.
Purpose
:
To retrieve a given number of characters from anywhere of
the target string.
Syntax
:
A$ = MID$( Str$, N%[, M%])
Example
:
Str$ = "ABCDEFGHIJK"
PRINT MID$(Str$,5,3)
PRINT MID$("123& #168IbB",6,5)
Description
:
A$
is a string variable to be assigned to the result.
Str$
may be a string variable, string expression, or string
constant.
N%
and
M%
are numeric expression.
This command returns a string of length
M%
characters from
Str$
beginning with the
N%
th character.
If
M%
is equal to zero, or if
N%
is greater than the length of
Str$
, then it returns a null string.