Description

Extracts substrings, including fields, values, and subvalues, from dynamic arrays, using ANSI characters 249 through 255 as delimiters.

Syntax

Remove variable From string At column Setting flag

Parameters

The Remove statement has the following parameters.

ParameterDescription
variable, stringVariable will contain the substring that is extracted from string.
ColumnIndicates the starting position of the string to be extracted. It is important to note that the Remove statement changes the column to point to the start of the next substring. The end of the substring occurs when an ANSI character from 249 to 255 is encountered.
Flag

Set with the following values, according to the delimiter found:

ValueMeaning
0End of string.
1Record mark ASCII character 255.
2Field mark ASCII character 254.
3Value mark ASCII character 253.
4Subvalue mark ASCII character 252.
5Text mark ASCII character 251.
6ASCII character 250.
7ASCII character 249.

Remove extracts data from a long string faster and more efficiently than does Extract, if doing sequential access through the array.

See also

Extract() functionBRemove statement

Example

* This code segment demonstrates the fastest way to sequentially access each element of a dynamic array.
dyn_array = "123": @FM: "678": @FM: "ABC"
position = 1
flag  = ""
Loop
    Remove current_element From dyn_array At position Setting flag
While flag
Repeat

 

 

Example 2

* Change row data into column data
equ ValueMark$ to 3
equ FieldMark$ to 2
 
authors = "" ; works = ""
 
dataList = "William Carlos Williams" : @vm : "Paterson" : @fm
dataList := "Eugene O'Neill" : @vm : "Desire Under the Elms" : @fm
dataList := "Barnard Malamud" : @vm : "The Natural" : @fm
dataList := "Mark Twain" : @vm : "The Mysterious Stranger" : @fm
dataList := "Richard Brautigan" : @vm : "Trout Fishing in America" : @fm
 
vPos = 0 ; vFlag = "" ; itemCtr = 0
 
loop
   remove thisItem from theList at vPos setting vFlag
   * Create two @vm-delimited arrays - one for Authors, one for Works
   begin case
      case ValueMark$
          authors := thisItem : @vm
      case FieldMark$
         works := thisItem : @vm
   end case
while vFlag
repeat
 
* Strip trailing @vm
authors[-1,1] = ""
works[-1,1] = ""
  • No labels

1 Comment

  1. Mary Jean Blink points out that the Case statement in the second code example should probably be rewritten like so:


       begin case
          case vFlag EQ ValueMark$
              authors := thisItem : @vm
          case vFlag EQ FieldMark$
             works := thisItem : @vm
       end case