find_first_not_of

Syntax:

    #include <string>
    size_type find_first_not_of( const string& str, size_type index = 0 ) const;
    size_type find_first_not_of( const char* str, size_type index = 0 ) const;
    size_type find_first_not_of( const char* str, size_type index, size_type num ) const;
    size_type find_first_not_of( char ch, size_type index = 0 ) const;

The find_first_not_of() function either:

For example, the following code searches a string of text for the first character that is not a lower-case character, space, comma, or hyphen:

    string lower_case = "abcdefghijklmnopqrstuvwxyz ,-";
    string str = "this is the lower-case part, AND THIS IS THE UPPER-CASE PART";
    cout << "first non-lower-case letter in str at: " << str.find_first_not_of(lower_case) << endl;

When run, find_first_not_of() finds the first upper-case letter in str at index 29 and displays this output:

    first non-lower-case letter in str at: 29

Related Topics: find, find_first_not_of, find_first_of, find_last_not_of, find_last_of, rfind