parseFloat()
Availability
Flash Player 5.
Usage
parseFloat(string)
Parameters
The string to read and convert to a floating-point number.
string
Returns
A number or
Nan
Description
Function; converts a string to a floating-point number. The function reads, or "parses," and
returns the numbers in a string until it reaches a character that is not a part of the initial number.
If the string does not begin with a number that can be parsed,
space preceding valid integers is ignored, as are trailing nonnumeric characters.
Example
The following examples use the
parseFloat("-2")
parseFloat("2.5")
parseFloat("3.5e6")
parseFloat("foobar")
parseFloat(" 5.1")
parseFloat("3.75math")
parseFloat("0garbage")
See also
NaN
588
Chapter 12: ActionScript Dictionary
.
parseFloat
returns
-2
returns
2.5
returns
3.5e6,
returns
NaN
returns
5.1
returns
3.75
returns
0
function to evaluate various types of numbers.
or
3500000
returns
parseFloat
NaN
. White
Need help?
Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?