Check out example codes for "find character in string c++". It will help you in understanding the concepts better.

Code Example 1

auto char_to_find = 'a'
if (str.find(char_to_find) != std::string::npos) {
    // character found
}

Code Example 2

size_t find (const string& str, size_t pos = 0) const;

Code Example 3

if (string1.find(string2) != std::string::npos) {
    std::cout << "found!" << '\n';
}

Code Example 4

word = 'geeks for geeks'
  
# returns first occurrence of Substring 
result = word.find('geeks') 
print ("Substring 'geeks' found at index:", result ) 
  
result = word.find('for') 
print ("Substring 'for ' found at index:", result ) 
  
# How to use find() 
if (word.find('pawan') != -1): 
    print ("Contains given substring ") 
else: 
    print ("Doesn't contains given substring")

Learn ReactJs, React Native from akashmittal.com