るりまサーチ (Ruby 2.7.0)

最速Rubyリファレンスマニュアル検索!
2件ヒット [1-2件を表示] (0.351秒)

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

クラス

検索結果

MatchData#to_s -> String (78643.0)

マッチした文字列全体を返します。

マッチした文字列全体を返します。

//emlist[例][ruby]{
/bar/ =~ "foobarbaz"
p $~ # => #<MatchData:0x401b1be4>
p $~.to_s # => "bar"
//}

Symbol#=~(other) -> Integer | nil (78409.0)

正規表現 other とのマッチを行います。

正規表現 other とのマッチを行います。

(self.to_s =~ other と同じです。)

@param other 比較対象のシンボルを指定します。

@return マッチが成功すればマッチした位置のインデックスを、そうでなければ nil を返します。

p :foo =~ /foo/ # => 0
p :foobar =~ /bar/ # => 3
p :foo =~ /bar/ # => nil

@see String#=~