[Newbies] '($1,925.46)' asNumber

Ron Teitelbaum ron at usmedrec.com
Fri Jul 1 17:25:00 UTC 2016


Hi Joe,

If you know the format is consistent and you don't really need much error handling then something like this would work

('($1,925.46)' reject: [:e | '($),' includes: e]) asNumber

All the best,

Ron Teitelbaum

> -----Original Message-----
> From: beginners-bounces at lists.squeakfoundation.org [mailto:beginners-
> bounces at lists.squeakfoundation.org] On Behalf Of Joseph Alotta
> Sent: Friday, July 01, 2016 12:41 PM
> To: beginners at lists.squeakfoundation.org
> Subject: [Newbies] '($1,925.46)' asNumber
> 
> Greetings,
> 
> I want to convert a String with parenthesis and dollar sign to a Number or
> Float.
> 
>  '($1,925.46)’ asNumber
> 
> Is there something out of the box that does this, or do I have to write it
> myself, character by character?
> 
> Should I use a ReadStream?
> 
> 
> Sincerely,
> 
> Joe.
> 
> 
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners



More information about the Beginners mailing list