The find_last_not_of() Family

The find_last_not_of() methods have these prototypes:

size_type find_last_not_of (const basic_string& str,                            size_type pos = npos) const noexcept;size_type find_last_not_of (const charT* s, size_type pos,                            size_type n) const;size_type find_last_not_of (const charT* s,                            size_type pos = npos) const;size_type find_last_not_of (charT c, size_type pos = npos) const noexcept;

These methods work like the corresponding find_last_of() methods, except that they search for the last occurrence of any character not in the substring.

Here’s code for finding the location of the last two occurrences of any of the letters not in "This" in a longer string: ...

Get C++ Primer Plus now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.