On 18 Sep 2011, at 21:37, Larry White wrote:
> Hi,
>
> I need to convert web input (Strings) to decimal numbers. I have a regex that will recognize numeric strings, but not all of them can be converted to a number with asNumber. �For example, anything with a leading $+ fails, as does anything beginning with '.' �(even though .3 isNumber answers true.) or '-.'
>
> Is there any code for dealing with this kind of thing (ie a method to be called before calling asNumber or a more robust library for string conversions? Given that all web input is strings and a lot of it is decimal numbers, i have to believe there is code somewhere that does this safely, maybe even with tests. :)
>
> Thanks.
Maybe Number class>>#readFrom:ifFail: would be helpful ?