parseint


Purpose
Convert a text into an integer.
Synopsis
function parseint(txt:text,start:integer):integer
function parseint(txt:text,start:integer,base:integer):integer
Arguments
txt 
A text object
start 
Starting position in the text
base 
Base to use for the conversion
Return value
The integer represented by the string.
Example
The following:
t:=text("a123.4b")
writeln(parseint(t,2))
writeln(getparam("sys_endparse"))
produces this output:
123
5
Further information
1. The parsing begins at the specified starting position and stops as soon as an invalid character is found. This location is then stored in the parameter sys_endparse.
2. The optional base argument may be used if the text is not expressed in base 10. Valid values for this parameter is 0 and 2 to 36. If base is zero or 16, the string may then include a '0x' prefix, and the number will be read in base 16. Furthermore, if the base is 0, the text will be read in base 8 if the first character is 0 and in base 10 otherwise.
Related topics
parsereal, parseextn, sys_endparse


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