function/MID$ function/MID$
NAME
MID$ -- Returns a substring
ABBREVIATION
m <shift> I
SYNOPSIS
MID$(<string>,<start_pos>,<length>)
FUNCTION
This function returns a string containing <length> characters, starting
from the <start_pos> character in string <string>. MID$ can also be used
on the left side of assignment statement as a pseudo-variable as well as
a function.
An error results if <start_pos>+<length> is greater than the length of
the source string (<string>).
INPUTS
<string> - source string
<start_pos> - starting position of the substring
<length> - length of the substring to be extracted or length of the
target area
RESULT
A string, which length is <length>, extracted from the source string
(<string>) at the given position (<start_pos>).
EXAMPLES
Using MID$ as a pseudo-variable:
10 A$="THE LAST GOODBYE"
20 PRINT A$
30 MID$(A$,6,3)="ONG"
40 PRINT A$
THE LAST GOODBYE
THE LONG GOODBYE
Using MID$ for extracting substring:
10 PRINT MID$("THE LAST GOODBYE",10,4)
GOOD
NOTES
None
BUGS
None
SEE ALSO
LEFT$()
RIGHT$()