Top  Previous  Next


The REMOVEF() function extracts data from a delimited character string.





REMOVEF(string{, delimiter{, count}})




stringis the string from which data is to be extracted.


delimiteris the delimiter character that separates elements of string. If omitted, a field mark is used. If delimiter is more than one character, only the first character is used. If delimiter is a null string, count characters are extracted.


countis the number of consecutive delimited elements of string to be extracted. If omitted or less than one, this defaults to one.



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:

1Null string
2End of string


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.








  PRINT "Reference number is " : REF



This program fragment prints successive elements from the comma delimited REF.LIST variable.



See also: