Testing for presence of substring : include « String « Ruby






Testing for presence of substring


s = "hello"
s.include?("ll")     # => true: "hello" includes "ll"
s.include?(?H)       # => false: "hello" does not include character H

 

Related examples in the same category

1.Does a string include another string