このマニュアルは既にメンテナンスが終了したバージョンの Ruby を対象としています。 最新版のマニュアルへ

Ruby 3.1 リファレンスマニュアル

instance method String#include?

include?(substr) -> bool[permalink][rdoc][edit]

文字列中に部分文字列 substr が含まれていれば真を返します。

[PARAM] substr:
検索する文字列
p "hello".include? "lo" #=> true
p "hello".include? "ol" #=> false
p "hello".include? ?h   #=> true