From: Robert Klemme Date: 2004-12-12T20:22:22+09:00 Subject: Re: Find every location of "th" in string. "William James" schrieb im Newsbeitrag news:1102809956.300284.26710@f14g2000cwb.googlegroups.com... > Find location of every "th" in "the thin man thinks". > > In Icon: > > every write(find("th", "the thin man thinks")) > > In Ruby: > > s='the thin man thinks' > t='th' > (0...s.size).each{|x| puts x if s[x,t.size]==t} > > Is there a better way? >> "the thin man thinks".scan( /th/ ) { puts $`.length } 0 4 13 => "the thin man thinks" Regards robert