parsetext


Purpose
Extract a text from a text.
Synopsis
function parsetext(txt:text,start:integer):text
function parsetext(txt:text):text
Arguments
txt 
A text object
start 
Starting position in the text
Return value
Decoded text.
Example
The following:
t:=text("a123.4b")
setparam("sys_sepchar",46)  ! '.'
writeln(parsetext(t,2))
writeln(getparam("sys_endparse"))
produces this output:
123
5
Further information
1. The behaviour of this routine depends on 2 control parameters: sys_sepchar defines a field separator that may mark the end of a non-quoted string and the parameter sys_qtype specifies the convention to use for quoted strings: if this parameter has value 0 (the default), Mosel quoting convention is used (both single and double quotes may be employed and with double quotes escape sequences are allowed); with value 1, C/C++ quoting convention applies (only double quotes with escape sequences). Finally, with value 2, CSV convention is expected (double quotes and repetition of double quotes to escape this character). The returned string is decoded: quotes are removed and escape sequences are replaced by their corresponding characters.
2. The parsing begins at the specified starting position and stops as soon as the separator character sys_sepchar is found or the quoted string is terminated. This location is then stored in the parameter sys_endparse. This control parameter is used as the starting position when start is not provided.
3. In case of error, getsysstat will return a negative value. A positive value indicates that a quoted string is unfinished (i.e. the end of the source text is reached although no matching quote has been found).
Related topics
parseint, parsereal, parseextn, nextfield, sys_sepchar, sys_qtype, sys_endparse
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.