Use Number() to convert string to a float number : Float : Data Type Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Data Type » Float »

 

Use Number() to convert string to a float number


 
 
package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){

        trace(Number("3.14"))// 3.14
        trace(Number("3.14 has a posse"))// NaN
 
    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Data Type
» Float