①string.substr(a,b)
B represents the standard characters removed from a starting (stressed: not a to b), for intercepting specified location substring, the amount of saving code
②strstr(a,b)
B Returns whether there is a string, since two parameters are char *, ... can not be used in actual fact the string class, string.c_str () can be converted to char * type
So as long as strstr (s1.c_str (), s2.c_str ()) on the line
③string.find(a)
Find whether there is a sub-string string string, no string :: npos (or a large positive number -1) is returned
to sum up:
② is to find a method of not using the O (N * M), sometimes with
③ violence is O (N * M), is not recommended