Hi all,

I am having some really strange things with the Number casll

here are some tests I've been running and some unexpecting things happened.

var str:String = "0023";
trace(str); // output 0023 - this correct and expected


var numb:Number = Number(str)
trace(numb); // output 19 - this incorrect and unexpected - was expecting
either 0023 or 23

var numb2:Number = Number("23")
trace(numb2); // output 23 - this correct and expected

var numb3:Number = Number("00"+"23")
trace(numb3); // output 19 - this incorrect and unexpected - was expecting
either 0023 or 23

var numb4:Number = Number("11"+"23")
trace(numb4); // output 1123 - this correct and expected

is there a bug with the class number and the use of 0 ? how am I supposed to
get 0023 or 23 out of "0023" (string) without cleaning the string and
looking for the 0's.

thanks

Seb
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to