Parseint Function - MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE Reference

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
Table of Contents

Advertisement

Example
The following examples use the
trace(parseFloat("-2")); // output: -2
trace(parseFloat("2.5")); // output: 2.5
trace(parseFloat(" 2.5")); // output: 2.5
trace(parseFloat("3.5e6")); // output: 3500000
trace(parseFloat("foobar")); // output: NaN
trace(parseFloat("3.75math")); // output: 3.75
trace(parseFloat("0garbage")); // output: 0
See also
,
NaN constant

parseInt function

parseInt function
parseInt(expression:String [, radix:Number]) : Number
Converts a string to an integer. If the specified string in the parameters cannot be converted to
a number, the function returns
numbers. Integers beginning with 0 or specifying a radix of 8 are interpreted as octal numbers.
White space preceding valid integers is ignored, as are trailing nonnumeric characters.
Availability: ActionScript 1.0; Flash Lite 2.0
Parameters
expression:String
[optional] - An integer representing the radix (base) of the number to parse.
radix:Number
Legal values are from 2 to 36.
Returns
- A number or
Number
Example
The examples in this section use the
numbers.
The following example returns 3:
parseInt("3.5")
The following example returns
parseInt("bar")
74
ActionScript language elements
parseFloat()
. Strings beginning with 0x are interpreted as hexadecimal
NaN
- A string to convert to an integer.
(not a number).
NaN
parseInt()
:
NaN
function to evaluate various types of numbers:
function to evaluate various types of

Advertisement

Table of Contents
loading

Table of Contents