End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
String#include?
include? other_string → 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);
return RBOOL(i != -1);
}
Returns true if self contains other_string, false otherwise:
Example
s = 'foo' s.include?('f') # => true s.include?('fo') # => true s.include?('food') # => false