How to check whether a string contains a substring in Ruby September 7, 2022 by Tarik You can use the include? method: my_string = "abcdefg" if my_string.include? "cde" puts "String includes 'cde'" end