Logo

Programming-Idioms

History of Idiom 39 > diff from v7 to v8

Edit summary for version 8 by :

Version 7

2015-08-19, 15:06:41

Version 8

2015-08-20, 16:02:03

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.

Imports
import std.algorithm.searching;
Code
bool ok = s.canFind(word);