Determines if a value can be converted to a floating-point.
The Lang.isFloat function returns a
boolean value that indicates whether a string value can be converted
into a floating-point number using the Lang.parseFloat function.
A true signifies that you can convert. A false signifies
that you cannot convert.
You can use the
Lang.float function to determine if the browser supports
floating-point arithmetic operations. Also, the Float Library
contains several functions that are designed to be used with
floating-point numbers.
<?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>
isFloat
example
</p>
<do type="accept">
<go
href="IsFloatExample.wmls#findisfloat( )" />
</do>
</card>
<card id="card2">
<p>
can convert = $(isfloattest)
</p>
</card>
</wml>
Code for IsFloatExample.wml
extern function
findisfloat( )
{
var str =
Dialogs.confirm("Enter a string", "");
var
result = Lang.isFloat(str);
WMLBrowser.setVar("isfloattest", result);
WMLBrowser.go("IsFloatExample.wml#card2");
};
Code for IsFloatExample.wmls