find_last_of

C++ Reference

find_last_of
Syntax:
  #include <string>
  size_type find_last_of( const string& str, size_type index = npos );
  size_type find_last_of( const char* str, size_type index = npos );
  size_type find_last_of( const char* str, size_type index, size_type num );
  size_type find_last_of( char ch, size_type index = npos );

The find_last_of() function either:

  • returns the index of the first character within the current string that matches any character in str, doing a reverse search from index, string::npos if nothing is found,
  • returns the index of the first character within the current string that matches any character in str, doing a reverse search from index and searching at most num characters, string::npos if nothing is found,
  • or returns the index of the first occurrence of ch in the current string, doing a reverse search from index, string::npos if nothing is found.
Related topics: