Example of String Searching
string strA = "This is a whole sentence.";
string strB = "is";
int loc;
// search for all occurrences of strB in strA
loc = strA.find(strB);
while ( loc != string::npos ) {
cout << '"' << strB << "\" found at location "
<< loc << endl;
loc = strA.find(strB,loc + strB.length());
}
string cset("aew"); // search set
loc = strA.find_first_of(cset); // value is 8 = position of first 'a'
loc = strA.find_first_of("ewa"); // value is 8 = posn of first 'a'
loc = strA.find_first_of("ewa",0,2); // value is 10 = posn of first 'w'
loc = strA.find_first_of("ewa",0,1); // value is 14 = posn of first 'e'
loc = strA.find_first_of("ewa",0,10); // value is 4 = posn of first ' '