Hey there all,
This should be simple. I need to know how to force a decimal place.
say i wanted to do 3.5.to_s
but i need that to be 3.50 as the string,
how would i do this?
thanks
Hey there all,
This should be simple. I need to know how to force a decimal place.
say i wanted to do 3.5.to_s
but i need that to be 3.50 as the string,
how would i do this?
thanks
say i wanted to do 3.5.to_s
but i need that to be 3.50 as the string,
Use String#% and friends:
â%.2fâ % 3.5
cool, thanks much !
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs