From: Chris Cummer Date: 2007-12-01T20:21:22+09:00 Subject: Re: Float Question On 1-Dec-07, at 2:25 AM, Robert Klemme wrote: > But it seems, few people know the star operator in printf format > strings. You can do this: > > irb(main):021:0> module Precision > irb(main):022:1> def format(decimals,total=0) > irb(main):023:2> sprintf "%*.*f", total, decimals, self > irb(main):024:2> end > irb(main):025:1> end You're right, I didn't know that one at all and it seems quite handy. Thanks for the tip.