#include
#include
int main ()
{
using namespace std;
string strSample ("Good day String!");
size_t nOffset = strSample.find ("day", 0);
size_t nSubstringOffset = strSample.find ("day", 0);
while (nSubstringOffset != string::npos)
{
cout << "\"day\" found at offset " << nSubstringOffset << endl;
// Make the 'find' function search the next character onwards
size_t nSearchOffset = nSubstringOffset + 1;
nSubstringOffset = strSample.find ("day", nSearchOffset);
}
return 0;
}