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

Joseph Alotta joseph.alotta at gmail.com
Fri Jul 1 18:59:03 UTC 2016


Thanks, Ron.  I needed to preserve the negative, so I append a minus sign, then use your snippet.
,

str := '($1,925.46)' .
('(*)' match: str ) ifTrue: [str := '-', str].
str := str reject:  [:e | '($,)' includes: e].
num := str asNumber  => -1925.46

Sincerely,

Joe.






--
View this message in context: http://forum.world.st/1-925-46-asNumber-tp4904523p4904534.html
Sent from the Squeak - Beginners mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20160701/0ce91a79/attachment.htm


More information about the Beginners mailing list