--0016364c7edda6e34f046ce5b88a Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Thanks, that helped On Sun, Jun 21, 2009 at 7:55 PM, Sebastian Hungerecker < sepp2k / googlemail.com> wrote: > Am Montag 22 Juni 2009 01:43:35 schrieb Zorigami: > > was wondering if anyone had any ideas on how I could make the following > > method "return "$#{@price}0" if "@price" only has one 0 after the ".", > and > > just "return "$#{@price}" if it has two? > > "$%.2f" % @price > > Note though that for accuracy reason it's best to store currency as an int > of > cents, not a float of dollars so then it would look like this: > "$%d.%02d" % @price.divmod(100) > > HTH, > Sebastian > > --0016364c7edda6e34f046ce5b88a--