
Chapter 15 Functions
15-59
MID$ (Function) [Conforms to SLIM]
Function
Extracts a character string for the designated number of characters from a
character string.
Format
MID$ (<character string >, <Start position>[, <Number of digits>])
Explanation
This statement extracts a character string for <Number of digits> from <Start
position> of <Character string>.
If the character string includes a NULL value, the NULL value is returned.
If a value longer than the character string is designated in <Number of digits>,
the whole character string is returned.
If <Number of digits> is ignored, or if the character string has fewer characters
than the number of digits designated, all characters after the start position are
returned.
If a value longer than the character string is designated in <Start position>, the
whole character string is returned.
Note: <Number of digits> is handled as byte counts.
Related Terms
LEN, LEFT$, RIGHT$
Example
DEFSTR ls1, ls2
ls1 = MID$( “abcdefg”, 2, 3 ) 'Assigns the character string “bcd” to ls1.
ls2 = MID$( ls1, 2, 2 ) '
Assigns the 2 digits from the second character of ls1 to
'
ls2.
Comentários a estes Manuais