|dynarray||An expression that resolves to a dynamic array from which successive data values are to be extracted.|
|delimcode||A local variable used to receive an integer code for the dynamic array delimiter type. delimcode cannot be a global variable or a subscripted variable.|
The REMOVE function efficiently extracts successive data values from a dynamic array. The extracted element value is returned. The delimiter type is placed in the delimcode variable. The REMOVE function operates on all dynamic array delimiter levels; in contrast, the REMOVE statement operates on a specified delimiter level.
REMOVE maintains an internal pointer so that repeated calls return successive element values. If REMOVE is called after the last element value has been extracted, it returns the empty string.
You can use the GETREM function to return the character position in dynarray of the REMOVE pointer.
The REMOVE function, REMOVE statement, and REVREMOVE statement all share the same character position pointer. It is incremented by Remove operations and decremented by Revremove operations.
The delimcode integer code values are as follows:
|0||End of file|
|1||@IM Item Mark CHAR(255)|
|2||@FM Field Mark CHAR(254)|
|3||@VM Value Mark CHAR(253)|
|4||@SM Subvalue Mark CHAR(252)|
|5||@TM Text Mark CHAR(251)|
The following example successively extracts the first five elements from a dynamic array:
names="Fred":@VM:"Barney":@FM:"Wilma":@VM:"Betty" FOR x=1 TO 5 PRINT REMOVE(names,lvl) PRINT lvl ! Returns: ! Fred ! 3 ! Barney ! 2 ! Wilma ! 3 ! Betty ! 0 ! "" ! 0 NEXT