equivalent of strcspn() and strpbrk()
#include <iostream>
#include <string>
using namespace std;
int main( )
{
string typing( "The quick, brown fox jumps over the lazy dog" );
cout << "String: " << typing << endl;
// equivalent of strcspn() and strpbrk()
string::size_type index = typing.find_first_of( "aeiou" );
if( index != string::npos )
cout << "\nThe first lower-case vowel is at index " << index;
else
cout << "\nThere is no lower-case vowel in the string";
}
Related examples in the same category