module Gemmy::Patches::StringPatch::InstanceMethods::IndexAll
Public Instance Methods
index_all(s, reuse=false)
click to toggle source
facets standard String#index only shows the first match
# File lib/gemmy/patches/string_patch.rb, line 179 def index_all(s, reuse=false) s = Regexp.new(Regexp.escape(s)) unless Regexp===s ia = []; i = 0 while (i = index(s,i)) ia << i i += (reuse ? 1 : $~[0].size) end ia end