Converts the value of its single parameter to an int
.
Returns
The integer
value that corresponds to the input parameter.
0
if the input is a string
that starts with a non-numeric
character. The integer part of the input if the input is a float
.
NULL
if the input is NULL
.
Remarks
For string
input parameters that start with a numeric character, but mix
numbers and letters, characters following the final number in a contiguous series of numbers
will be
ignored.
... <textview id="mixedString1" label="Input parameter 1" text="ggg5343"/> <textview label="toint() returns 0 for strings that start with non-numeric characters" text='{TOSTRING(TOINT(mixedString1.text))}'/> <textview id="mixedString2" label="Input parameter 2" text="5343ggg65"/> <textview label="Characters after the first contiguous set of numbers are ignored" text='{TOSTRING(TOINT(mixedString2.text))}'/> <textview id="mixedString3" label="Input parameter 3" text="5343.65ggg18.3"/> <textview label="For floats, the largest integer less than the input is returned" text='{TOSTRING(TOINT(mixedString3.text))}'/> ...
Sample
... <textbox id="string" label="Enter something you want to see as a number" text=""/> <textview label="Is this the output you expected?" text='{TOSTRING(TOINT(string.text))}'/> <numberbox id="number" label="Enter a floating point number" numberFormat='{decimalSeparator: ".", maxFraction:3}' float="true"/> <textview label="This is what toint() gives you" text='{TOSTRING(TOINT(number.number))}'/>
Copyright © 2016 Mobilengine Corp. All rights reserved. version: 7.0.4.19927