るりまサーチ (Ruby 2.6.0)

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

別のキーワード

  1. string []=
  2. string slice
  3. string slice!
  4. string []
  5. string gsub!

ライブラリ

クラス

検索結果

StringScanner#matched? -> bool (63394.0)

前回のマッチが成功していたら true を、 失敗していたら false を返します。

前回のマッチが成功していたら true を、
失敗していたら false を返します。

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

s = StringScanner.new('test string')
s.matched? # => false
s.scan(/\w+/) # => "test"
s.matched? # => true
s.scan(/\w+/) # => nil
s.matched? # => false
s.scan(/\s+/) # => " "
s.matched? # => true
//}