Sha256: 0e2c67e12c8e74a6e1cafd5c6e793f0c8397fc1d1c4dbb8058b0096f5819287f

Contents?: true

Size: 255 Bytes

Versions: 2

Compression:

Stored size: 255 Bytes

Contents

class String
  # Counts # of times the given string is in the string. This is unlike String.count which
  # only counts the given characters.
  def count_any(str)
    count = 0
    self.gsub(str) {|s| 
      count += 1
      str
    }
    count
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cldwalker-core-0.0.0 lib/core/string.rb
cldwalker-core-0.1.0 lib/core/string.rb