Natalia Natalia - 24 days ago 8
Ruby Question

How do I get the numbers after the decimal point without the "0" or the "."

With Ruby, if I have a number

0.123425


How can I return the numbers after the decimal point? (e.g. "123425")

Answer Source

Here you go

(number.to_s).split('.').last.to_i

thanks to moveson for suggesting edit.