End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
String#include?
str.include? other_str → true or false
string.c
View on GitHub ↗
static VALUE
rb_str_include(VALUE str, VALUE arg)
{
long i;
StringValue(arg);
i = rb_str_index(str, arg, 0);
if (i == -1) return Qfalse;
return Qtrue;
}
Returns true if str contains the given string or character.
Example
"hello".include? "lo" #=> true "hello".include? "ol" #=> false "hello".include? ?h #=> true