Re: Printing numbers

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Printing numbers

Mariano Martinez Peck


On Tue, Feb 24, 2015 at 4:55 PM, Mariano Martinez Peck <[hidden email]> wrote:
Hi guys,

I have quite some reports that print several numbers. Until now we were using the default #greaseString. However, we now need to be able to start printing nicer and customizable. For example, I may want to put a comma every 3 numbers and dots for the decimals. And choose how many decimals. And maybe also choose to use scientific notation, etc....

Also, I need this for both, Pharo and GemStone. I wish I don't have to start building yet again my own number formatting library... so.. is there something available I could take a look?

Thanks in advance,  



--
Reply | Threaded
Open this post in threaded view
|

Re: Printing numbers

Mariano Martinez Peck
OK...Grease could be a start...

(GRNumberPrinter new
            separator: $,;
            precision: 2; yourself)  print: 12345678

On Tue, Feb 24, 2015 at 4:55 PM, Mariano Martinez Peck <[hidden email]> wrote:
Hi guys,

I have quite some reports that print several numbers. Until now we were using the default #greaseString. However, we now need to be able to start printing nicer and customizable. For example, I may want to put a comma every 3 numbers and dots for the decimals. And choose how many decimals. And maybe also choose to use scientific notation, etc....

Also, I need this for both, Pharo and GemStone. I wish I don't have to start building yet again my own number formatting library... so.. is there something available I could take a look?

Thanks in advance,  



--
Reply | Threaded
Open this post in threaded view
|

Re: Printing numbers

philippeback
In reply to this post by Mariano Martinez Peck
This one may come handy.

http://smalltalkhub.com/#!/~philippeback/HOExtras/packages/Printf

Works like a C printf.

Coupled with 'Blah {1} and {2}' format: { '5.2d' printf: aNumber.
'%5s' printf: aString } it can go a long way.

Phil

Reply | Threaded
Open this post in threaded view
|

Re: Printing numbers

Pharo Smalltalk Users mailing list
Nice. Good to know about.
thanks,
cam

On Tue, Feb 24, 2015 at 3:49 PM, [hidden email] <[hidden email]> wrote:
This one may come handy.

http://smalltalkhub.com/#!/~philippeback/HOExtras/packages/Printf

Works like a C printf.

Coupled with 'Blah {1} and {2}' format: { '5.2d' printf: aNumber.
'%5s' printf: aString } it can go a long way.

Phil