Piece$ (Function)

Fetches the specified part separated by the specified character from the character string.

Piece$ (<Character String>,<Separation Character>,<Starting No.>,<Ending No.>) 

Parameters
<Character String>
The separated Character String (character string).
<Separation Character>
The character used for separation (character string).
<Starting No.>
The starting number for extraction (integer).
<Ending No.>
The ending number for extraction (integer).

Return Value
Returns the value of the character type string.
The content of the value is the extracted character string.

Description
Fetches the part of the character string separated by the <Separation Character> from the specified <Character String> in the range indicated by the <Starting No.> and <Ending No.>.
If the part of the character string separated by the <Separation Character> does not exist, the entire character string is returned.
Specify a number of 1 or more in <Starting No.> and <Ending No.>.
When the <Starting No.> is greater than the <Ending No.> the Null string (" ") is returned.
When the <Ending No.> exceeds the numerical range that can be specified, it is assumed to be the largest specifiable number and the character string is returned.

Example
Fetch the character string separated with semicolons (;).
      STRING1$=Piece$ ("PIECE1;PIECE2;PIECE3;PIECE4",";",1,1)
        STRING2$=Piece$ ("PIECE1;PIECE2;PIECE3;PIECE4",";",3,4)

The results are as follows:
STRING1$="PIECE1"
STRING2$="PIECE3
PIECE4"