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
Arguments
txt 
A text object
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
 setparam("sys_sepchar",44)  ! ','
 setparam("sys_endparse",0)
 while(nextfield(t)) do
  returned+=[parsetext(t)]
 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 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.
Related topics
parseint, parsereal, parseextn, parsetext
Module
mmsystem


If you have any comments or suggestions about these pages, please send mail to support@fico.com.

© Copyright 2001-2013 Fair Isaac Corporation. All rights reserved.