Returns the integer portion of a floating-point number.
The Float.int function returns the
integer portion of a given floating-point number. The decimal and all
digits to the right of the decimal are simply discarded. If the number
is already an integer, then that same integer value will be returned.
If the browser does not support floating-point
arithmetic operations, then the browser will not recognize the Float
Library, nor any of the member functions. In this case, the
Float.int function returns invalid.
<?xml
version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD
WML 1.1//EN"
"http://www.WAPforum.org/DTD/wml_1.1.xml">
<wml>
<card id="card1">
<p>
int
example
</p>
<do type="accept">
<go
href="IntExample.wmls#findint()" />
</do>
</card>
<card id="card2">
<p>
original number = $(number)
<br />
integer
portion = $(intnumber)
</p>
</card>
</wml>
Code for IntExample.wml
extern function
findint()
{
var mydefault =
"71.348";
var result =
Dialogs.prompt("Enter any number", mydefault);
var intnum = Float.int(result);
WMLBrowser.setVar("number", result);
WMLBrowser.setVar("intnumber", intnum);
WMLBrowser.go("IntExample.wml#card2");
};
Code for IntExample.wml