%StrToI function


Function
The function converts an expression of Text type (string) to an integer value. If the string does not contain a correct integer number, it returns invalid value.
Declaration
INT %StrToI(
   TEXT in string
 )

Parameters
string Text string.

Function
The function can convert the value using a different base than decimal if it is written in notation [-]base#number#, where base is a given base (between 2 and 16).

Example: 2#100# (8 in decimal notation), 5#12# (7 in decimal notation), 16#23# (35 in decimal notation), -8#12# (-10 in decimal notation).


Example
 INT _i

 _i  := %StrToI ( "255" )          ; returns integer value of 255
 _i  := %StrToI ( "16#23#" )       ; returns integer value of 35
 _i  := %StrToI ( "-2#100#" )      ; returns integer value of -4 

Napíšte komentár