Initializing help system before first use

# 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 (default value depends on which other arguments are used)
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
parseint, parsereal, parseextn, parsetext, getsysstat
Module
mmsystem
Parent Topic Procedures and functions

© 2001-2026 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.