Hi,
In order to search for a particular character in a C++ string, use the following code.
#include <iostream> #include <cstring> using namespace std; int main() { const char *testStr= "coderz@heaven" ; const char *temp; // Searching temp = strchr(testStr, '@' ); if (temp ) cout << "Found" ; return 0 ; } |