C++ string find Searching Within Strings by offset
#include <iostream> #include <string> using namespace std; int main(int argc, char *argv []) { /*w w w . j a va2s . c om*/ string myString{ "This is my string!" }; size_t found = myString.find("is"); if (found != string::npos) { cout << "\" is\" found at position: " << found << endl; } found = myString.find("is", found+1); if (found != string::npos) { cout << "is found at position: " << found << endl; } return 0; }