Sha256: baa675e6ae1c424ce17f8ab518147578771f0b5d80be5e3dd0146355c075c567

Contents?: true

Size: 367 Bytes

Versions: 8

Compression:

Stored size: 367 Bytes

Contents

# http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/7370f94e852c0fae/4068c8c1c1c158ee
class String
  def scan_i seq
    pos=0
    ndx=[]
    slen = seq.length
    while i=index(seq,pos)
      ndx << i
      pos = i + slen
    end
    ndx
  end

  #def scan_enum seq
  #  self.enum_for(:scan, seq).map do 
  #    $~.offset(0)[0]
  #  end
  #end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mspire-0.4.9 lib/scan_i.rb
mspire-0.3.0 lib/scan_i.rb
mspire-0.3.9 lib/scan_i.rb
mspire-0.3.1 lib/scan_i.rb
mspire-0.4.2 lib/scan_i.rb
mspire-0.4.4 lib/scan_i.rb
mspire-0.4.5 lib/scan_i.rb
mspire-0.4.7 lib/scan_i.rb