You could use a for-loop (rather than a recursive function) to strip off
leading 0's.

- Gordon


-----Original Message-----
From: Rich Tretola [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 07, 2005 12:16 PM
To: [email protected]
Subject: [flexcoders] Hex Issue on a string to number cast?



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. 
I am assuming that this is seen as a hex value when casting. Is there an
easy way to avoid this without doing some crazy recursive string functions
checking each character until I am sure the 1st character is not a 0 before
the cast to Number() ? If someone enters 0100 by mistake, it should be set
as 100.

Rich



Yahoo! Groups Links








Reply via email to