Mega Code Archive

 
Categories / C++ / String
 

String find_first_of( substring )

#include <iostream> using std::cout; using std::endl; #include <string> using std::string; int main() {    string string1( "This is a test string!");    int location;        location = string1.find_first_of( "is" );    cout << "\n\n(find_first_of) found '" << string1[ location ]       << "at: " << location;    return 0; } /*  (find_first_of) found 'iat: 2  */