[Rails] Re: Remove trailing zeros

2009-03-12 Thread northband_101
Thanks Matt - I'll try this out. Best, NB On Feb 27, 4:33 pm, Matt Jones al2o...@gmail.com wrote: The %g specifier to sprintf will do this automatically: %g % 1.0 = 1 %g % 1.375 = 1.375 --Matt Jones On Feb 27, 1:20 am, northband northb...@gmail.com wrote: Hi - I am working with

[Rails] Re: Remove trailing zeros

2009-02-27 Thread pepe
Maybe you can convert them to integers? my_float = 2.0 my_float = my_float.to_i if my_float == my_float.to_i Pepe On Feb 27, 1:20 am, northband northb...@gmail.com wrote: Hi - I am working with floats and am wondering how I can trim the decimal and trailing zeros on my whole numbers.  For

[Rails] Re: Remove trailing zeros

2009-02-27 Thread northband_101
Thanks - this seems easy enough. On Feb 27, 3:12 pm, pepe p...@betterrpg.com wrote: Maybe you can convert them to integers? my_float = 2.0 my_float = my_float.to_i if my_float == my_float.to_i Pepe On Feb 27, 1:20 am, northband northb...@gmail.com wrote: Hi - I am working with

[Rails] Re: Remove trailing zeros

2009-02-27 Thread Matt Jones
The %g specifier to sprintf will do this automatically: %g % 1.0 = 1 %g % 1.375 = 1.375 --Matt Jones On Feb 27, 1:20 am, northband northb...@gmail.com wrote: Hi - I am working with floats and am wondering how I can trim the decimal and trailing zeros on my whole numbers.  For instance,