To find a character or another string, you can use [std::string::find](<http://en.cppreference.com/w/cpp/string/basic_string/find>). It returns the position of the first character of the first match. If no matches were found, the function returns [std::string::npos](<http://en.cppreference.com/w/cpp/string/basic_string/npos>)

https://codeeval.dev/gist/3e5fa2b5e77660da2821e9c5511560e4

The search opportunities are further expanded by the following functions:

find_first_of     // Find first occurrence of characters 
find_first_not_of // Find first absence of characters 
find_last_of      // Find last occurrence of characters 
find_last_not_of  // Find last absence of characters

These functions can allow you to search for characters from the end of the string, as well as find the negative case (ie. characters that are not in the string). Here is an example:

https://codeeval.dev/gist/e472783c28ebc05df108ff7fc9efb447

Note: Be aware that the above functions do not search for substrings, but rather for characters contained in the search string. In this case, the last occurrence of 'g' was found at position 6 (the other characters weren’t found).