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

Code Example 1

#include <iostream>
#include <string>
#include <algorithm>
#include <functional>

int main()
{
    std::string in = "Lorem ipsum dolor sit amet, consectetur adipiscing elit,"
                     " sed do eiusmod tempor incididunt ut labore et dolore magna aliqua";
    std::string needle = "pisci";
    auto it = std::search(in.begin(), in.end(),
                   std::boyer_moore_searcher(
                       needle.begin(), needle.end()));
    if(it != in.end())
        std::cout << "The string " << needle << " found at offset "
                  << it - in.begin() << '\n';
    else
        std::cout << "The string " << needle << " not found\n";
}

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';
}

Learn ReactJs, React Native from akashmittal.com