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