Logo

Programming-Idioms

History of Idiom 39 > diff from v28 to v29

Edit summary for version 29 by programming-idioms.org:
New Lua implementation by user [programming-idioms.org]

Version 28

2016-11-11, 20:01:51

Version 29

2016-11-11, 20:05:17

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 = false
if s:find(word, 1, true) then ok = true end