C
Chad Weier
I have a method which calculates values and creates and object in a
class
Acalculation.new(valuea, valueb)
they go to
def to_s
"#{@valuea}#{@valueb}"
end
If valuea is 100 and valueb is 555555.5555
What would be the neatest and cleanest way to convert them to a
formatted value like this (note the rounding also)
valuea - 100.00 valueb - 555,555.56
I've found lots of code that does bit and pieces like I need but not
anything that does commas and rounding to 2 decimal places.
class
Acalculation.new(valuea, valueb)
they go to
def to_s
"#{@valuea}#{@valueb}"
end
If valuea is 100 and valueb is 555555.5555
What would be the neatest and cleanest way to convert them to a
formatted value like this (note the rounding also)
valuea - 100.00 valueb - 555,555.56
I've found lots of code that does bit and pieces like I need but not
anything that does commas and rounding to 2 decimal places.