C++ string search for a single letter
#include <iostream> #include <string> using namespace std; int main(int argc, char *argv []) { //from w w w . ja va 2 s. c o m string myString{ "This is my string!" }; found = myString.find_first_of("msg"); if (found != string::npos) { cout << "is found at position: " << found << endl; } return 0; }