Sha256: ea4d59a5e751c6ad4b3e7fd0502f92edc41398daf396c8cd7ac4e08aa39e6bc8

Contents?: true

Size: 243 Bytes

Versions: 4

Compression:

Stored size: 243 Bytes

Contents

# frozen_string_literal: true

class String
  THOUSAND_SEPARATOR = ','

  #Taken from http://codesnippets.joyent.com/posts/show/330
  def commify(delimiter = THOUSAND_SEPARATOR)
    gsub(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1#{delimiter}")
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gruff-0.11.0 lib/gruff/patch/string.rb
gruff-0.11.0-java lib/gruff/patch/string.rb
gruff-0.10.0 lib/gruff/patch/string.rb
gruff-0.10.0-java lib/gruff/patch/string.rb