:05
An: flexcoders@yahoogroups.com
Betreff: RE: [flexcoders] Re: Number(011) = 9
If you do parseInt(011, 10), I'm pretty sure what happens is this:
1. The octal literal 011 is compiled as the decimal Number 9.
2. It is converted at runtime to the string 9, because parseInt expects
trag von Gordon Smith
Gesendet: Dienstag, 4. Oktober 2005 20:05 An:
flexcoders@yahoogroups.com Betreff: RE: [flexcoders] Re: Number("011") =
9 If you do parseInt(011, 10), I'm pretty sure what
happens is this: 1. The octal literal 011 is compiled as the
decimal Number 9. 2. It
You might want to alter Abdul's function slightly if you expect more
than one leading zero:
function getDecimalNumber(numStr:String):Number
{
if(numStr.indexOf(0)== 0)
{
return getDecimalNumber(numStr.substr(1));
}
return Number(numStr);
}
Qabiz
Sent: Tuesday, October 04, 2005 10:29 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Re: Number(011) = 9
Hi,
What do you want to do?
Convert 011 to decimal 11
Or convert octal(11) to decimal(9)
parseInt(..) is a global function and first argument is an expression, so
4 matches
Mail list logo