Logo

Programming-Idioms

History of Idiom 39 > diff from v13 to v14

Edit summary for version 14 by :

Version 13

2015-08-22, 00:46:05

Version 14

2015-09-03, 15:42:42

Idiom #39 Check if string contains a word

Set boolean ok to true if string word is contained in string s as a substring, or to false otherwise.

Idiom #39 Check if string contains a word

Set boolean ok to true if string word is contained in string s as a substring, or to false otherwise.

Code
ok = s.include?(word)
Doc URL
http://ruby-doc.org/core-2.2.3/String.html#method-i-include-3F