[Seaside] Smalltalk float to currency how to ?

Dmitry Dorofeev dima-sender-3c337a at yasp.com
Tue Jan 31 15:11:55 CET 2006


Hi all,

I have Float in form:
12.0
123.3453
etc
and want to format it to two-digits-after-dot.
Searched through classes but found nothing suitable except

n := 12.6.
String streamContents: [:s|
 n absPrintOn: s base: 10 digitCount: n asInteger asString size + 2.
]

while it works fine for any float like 12.3245
it does not add zero to float like 12.6 :-(
I would like to see 12.60

Is there simple way to do it ?
like fprintf in C/Perl world ?

Thanks.
-Dmitry.


More information about the Seaside mailing list