Mid$(Function)
Fetches a part of the character string.
Mid$ (<Character String>,<Starting Position>,<No. of Characters>)
Parameters
<Character String>
|
The Character String to be extracted (character type).
|
<Starting Position>
|
The position to begin extraction (integer type).
|
<No. of Characters>
|
The number of characters to be extracted (integer type).
|
Return Value
The character string taken out.
Description
Fetches the <No. of Characters> from within the <Character String> starting from the specified <Starting Position>.
Specify the range of the <No. of Characters> of the character string from 1 from the extraction starting position.
The value of the <Starting Position> and the <No. of Characters> must be 1 or more.
The value of the <Starting Position> must be less than the length of the <Character String>.
Specify the number of characters to extract from the character string in <No.of Characters>.
When the <No. of Characters> is greater than the <No. of Characters> to the right of the <Starting Position>, the entire character string to the right of <Starting Position> is extracted.
Example
INPUTSTR$="ABCDEFG"
OUTPUTSTR1$=Mid$(INPUTSTR$, 2, 4)
OUTPUTSTR2$=Mid$(INPUTSTR$, 3, 8)
The result is as follows:
OUTPUTSTR1$="BCDE"
OUTPUTSTR2$="CDEFG"