Thanks,

I know that I can use a loop, I was just wondering why the default
behavior in actionscript is to automatically assume that testString is
hex and that testNumber evaluates to 64 in the sample below:

var testString 0100:String;
var testNumber = Number(testString);

Rich



On Tue, 8 Mar 2005 11:49:38 +0530, Manish Jethani
<[EMAIL PROTECTED]> wrote:
> 
> On Mon, 7 Mar 2005 15:16:02 -0500, Rich Tretola <[EMAIL PROTECTED]> wrote:
> 
> > I have a text input that I am using as a free input field for a
> > number. I have it restricted to 0-9 characters and am casting it to a
> > number when setting the value to my object. The problem is that if
> > someone enters a value with a leading 0 such as 0100 it casts to 64.
> 
> var s:String = "000100";
> if (s.charAt(0) == "0") {
> for (var i:Number = 0; i < s.length; i++)
> if (s.charAt(i) != "0")
> break;
> s = s.substr(i);
> }
> trace(s);
> 
> Manish
> 
> 
> Yahoo! Groups Links
> 
> 
> 
> 
>


Reply via email to