Class: Float
- Inherits:
-
Object
- Object
- Float
- Defined in:
- lib/bblib/core/util/number.rb
Instance Method Summary collapse
-
#to_delimited_s(delim = ',') ⇒ Object
Convert this integer into a string with every three digits separated by a delimiter on the left side of the decimal.
Instance Method Details
#to_delimited_s(delim = ',') ⇒ Object
Convert this integer into a string with every three digits separated by a delimiter on the left side of the decimal
105 106 107 108 109 |
# File 'lib/bblib/core/util/number.rb', line 105 def to_delimited_s(delim = ',') split = self.to_s.split('.') split[0] = split.first.reverse.gsub(/(\d{3})/, "\\1#{delim}").reverse split.join('.').uncapsulate(',') end |