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

2016-07-01 Thread Ron Teitelbaum
 

From: Joseph Alotta
Sent: Friday, July 01, 2016 2:59 PM



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



[Ron Teitelbaum] Excellent!  Well done!

,

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

Sincerely, 

Joe. 




 

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


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

2016-07-01 Thread Joseph Alotta
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.___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners