REMOVEF() |
|
|
The REMOVEF() function extracts data from a delimited character string.
Format
REMOVEF(string{, delimiter{, count}})
where
The REMOVEF() function uses the same optimised method as the REMOVE() function to extract items from string sequentially but uses a specified delimiter character instead of terminating on any mark character.
Whenever a string is assigned to a variable the remove pointer is set to point one character before the start of the string. Subsequent uses of REMOVEF() advance the point by one character and then extract characters from the position of the remove pointer up to the next delimiter character or the end of the string. Because the remove pointer gives immediate access to the position at which the REMOVEF() should commence, this operation requires no searching and is therefore very fast.
Once the end of the string has been reached, the remove pointer remains positioned one character beyond the end of the string and further REMOVEF() operations would return a null string.
The REMOVEF() function uses the STATUS() function to return information about its outcome:
The remove pointer may be reset to the start of the string by assigning a new value to string. Where it is required to reset the remove pointer without changing the string, the SETREM statement can be used. Alternatively, applications frequently use a statement such as S = S which will assign S to itself thus resetting the remove pointer.
Examples
LOOP REF = REMOVEF(REF.LIST, ',') UNTIL STATUS() PRINT "Reference number is " : REF REPEAT
This program fragment prints successive elements from the comma delimited REF.LIST variable.
See also: |