Ruby/String/include

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

(Различия между версиями)
Перейти к: навигация, поиск
м (1 версия)
 

Текущая версия на 17:56, 13 сентября 2010

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