Skip to content
instance method

String#include?

(::string other_string) -> bool
include?(other_string) → true or false

Returns whether self contains other_string:

Example
s = 'bar'
s.include?('ba')  # => true
s.include?('ar')  # => true
s.include?('bar') # => true
s.include?('a')   # => true
s.include?('')    # => true
s.include?('foo') # => false

Related: see Querying.

See also #hex #index #hash #initialize_copy also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0