Check out example codes for "npos in cpp". It will help you in understanding the concepts better.

Code Example 1

found = str.find(str2);

if (found != std::string::npos)
    std::cout << "first 'needle' found at: " << int(found) << std::endl;

Learn ReactJs, React Native from akashmittal.com