るりまサーチ (Ruby 3.0)

最速Rubyリファレンスマニュアル検索!
1件ヒット [1-1件を表示] (0.062秒)
トップページ > クラス:StringScanner[x] > バージョン:3.0[x] > クエリ:c[x] > クエリ:[][x]

別のキーワード

  1. _builtin to_c
  2. etc sc_2_c_dev
  3. etc sc_2_c_bind
  4. tracer display_c_call
  5. tracer display_c_call=

ライブラリ

検索結果

StringScanner#[](nth) -> String | nil (63304.0)

前回マッチした正規表現の nth 番目のかっこに対応する部分文字列を 返します。インデックス 0 はマッチした部分全体です。前回のマッチが 失敗していると常に nil を返します。

...規表現の nth 番目のかっこに対応する部分文字列を
返します。


//emlist[例][ruby]{
require 'strscan'

s = StringScanner.new('test string')
s.scan(/\w(\w)(\w*)/) # => "test"
s[0] # => "test"
s[1] # => "e"
s[2] # =>...