22件ヒット
[1-22件を表示]
(0.024秒)
検索結果
-
MatchData
# begin(n) -> Integer | nil (18146.0) -
n 番目の部分文字列先頭のオフセットを返します。
...。
@raise IndexError 範囲外の n を指定した場合に発生します。
//emlist[例][ruby]{
/(foo)(bar)(BAZ)?/ =~ "foobarbaz"
p $~.begin(0) # => 0
p $~.begin(1) # => 0
p $~.begin(2) # => 3
p $~.begin(3) # => nil
p $~.begin(4) # => `begin': index 4 out of matches (IndexError)
//}... -
MatchData
# end(n) -> Integer | nil (15.0) -
n 番目の部分文字列終端のオフセットを返します。
...e IndexError 範囲外の n を指定した場合に発生します。
//emlist[例][ruby]{
/(foo)(bar)(BAZ)?/ =~ "foobarbaz"
p $~.end(0) # => 6
p $~.end(1) # => 3
p $~.end(2) # => 6
p $~.end(3) # => nil
p $~.end(4) # => `end': index 4 out of matches (IndexError)
//}
@see MatchData#begin...