Searching s1.find_first_of(s2); first element of s1 also in s2 s1.find_last_of(s2); last element of s1 also in s2 std::string s1 = "abcdef---defghi"; std::string s2 = "gec"; s1.find_first_of(s2); // returns 2 s1.find_last_of(s2); // returns 12