nextfield
| nextfield | 
  Purpose
 
 Advance to next field in a structured text string.
 
  Synopsis
 
function nextfield(txt:text,start:integer,trim:boolean):boolean
 function nextfield(txt:text):boolean
 function nextfield(txt:text,pctx:parsectx):boolean
 
  Arguments
 
| 
     txt 
     | 
     A
     text object
     | 
| 
     pctx 
     | 
     A parser context
     | 
| 
     start 
     | 
     Starting position in the text
     | 
| 
     trim 
     | 
     Whether to skip blank characters around separators
     | 
  Return value
 
 true if more data can be parsed.
  Example
 
 The following function returns the list of records of a text string using comma as the field separator character:
 
function split(t:text):list of text declarations pctx:parsectx end-declarations pctx.sepchar:=44 ! ',' while(nextfield(t,pctx)) do returned+=[parsetext(t,pctx)] end-do end-function
  Further information
 
 1. When
 start is
 0, this routine saves the position of the first character of the text string in the control parameter
 sys_endparse and returns
 true.
 
 2. When
 start is greater than
 0 and the character located at position
 start is the separator character
 sys_sepchar, the position
 start+1 is saved in control parameter
 sys_endparse and
 true is returned. In all other cases
 false is returned.
 
 3. This function returns
 false if the provided text
 txt is empty or the starting position
 start is not valid.
 
 4. If argument
 trim is
 true, blank characters are skipped before and after the separator character. The provided value is saved in parameter
 sys_trim when
 start is
 0.
 
 5. In the second form of the routine, parameters
 sys_endparse and
 sys_trim are used as default values for arguments
 start and
 trim.
 
 6. The version using a parser context works with the information contained in this context instead of the global parameters (see Section
 The type parsectx).
 
  Related topics
 
  Module
 
 
