Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
How to format decimals on the fly (for EOF blocks)?
Jesse Crockett
8/28/2008 11:23:00 AM
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 <<EOF
output?
--
Posted via
http://www.ruby-...
.
1 Answer
Jesse Crockett
8/28/2008 12:00:00 PM
0
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 <<EOF
> output?
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
How to format decimals on the fly (for EOF blocks)?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password