From: Jesse Crockett Date: 2008-08-28T21:00:01+09:00 Subject: Re: How to format decimals on the fly (for EOF blocks)? sprintf ! Jesse Crockett wrote: > Hello, I'm facing a problem where, for instance, 7mcg of Nutrient is > required per day. It's scaled in the db to 3 (or more) decimal places, > but on the page, often there will show > > Nutrient 0 mcg 8% > > -- otherwise ... 0.4423 mcg 8% > > My figures are for demonstration only :-) > > Is there a way to covert the latter mcg figure to 0.4 on the fly? Or do > I need to work on the database, since these are mainly for string < output? -- Posted via http://www.ruby-forum.com/.