class String

Public Instance Methods

indices_of_pattern(pattern) click to toggle source
# File lib/extensions/string.rb, line 2
def indices_of_pattern(pattern)
  indices = []
  split("").each_with_index do |_, idx|
    if self[idx..-1].start_with?(pattern)
      indices  << idx
    end
  end
  indices
end