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

Code Example 1

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

Code Example 2

std::string parentstring = "Hello Agnosticdev, I love Tutorials";
std::string substring = "Agnosticdev";
auto index = parentstring.find(substring);

Code Example 3

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

Learn ReactJs, React Native from akashmittal.com