Ruby初心者質問スレPart2
■ このスレッドは過去ログ倉庫に格納されています
0655デフォルトの名無しさん
2005/07/21(木) 23:21:30class String
def indices(arg, &block)
pos = 0
setter = eval("proc{|m|$~=m}", block)
while (pos = index(arg, pos)) do
setter.call($~)
yield pos
pos += 1
end
end
end
■ このスレッドは過去ログ倉庫に格納されています