#include <iostream>
#include <string>
using namespace std;
int main( )
{
string typing( "The quick, brown fox jumps over the lazy dog" );
cout << "String: " << typing << endl;
// find first occurrence of a substring - equivalent of strstr()
string::size_type index = typing.find( "fox" );
if( index != string::npos )
cout << "\n\"fox\" first occurs at index " << index;
else
cout << "\n\"fox\" is not in the string";
}
|