Ruby/String/include

Материал из Wiki.crossplatform.ru

Перейти к: навигация, поиск

Does a string include another string

string = "My first string"                   # => "My first string"
string.include? "MY"                     # => true



Testing for presence of substring

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