public member function
<string>
std::string::find_first_not_of string (1)size_t find_first_not_of (const string& str, size_t pos = 0) const;c-string (2)
size_t find_first_not_of (const char* s, size_t pos = 0) const;buffer (3)
size_t find_first_not_of (const char* s, size_t pos, size_t n) const;character (4)
size_t find_first_not_of (char c, size_t pos = 0) const;string (1)
size_t find_first_not_of (const string& str, size_t pos = 0) const noexcept;c-string (2)
size_t find_first_not_of (const char* s, size_t pos = 0) const;buffer (3)
size_t find_first_not_of (const char* s, size_t pos, size_t n) const;character (4)
size_t find_first_not_of (char c, size_t pos = 0) const noexcept;
Find absence of character in string
Searches the string for the first character that does not match any of the characters specified in its arguments.When pos is specified, the search only includes characters at or after position pos, ignoring any possible occurrences before that character.
size_t is an unsigned integral type (the same as member type string::size_type).
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// string::find_first_not_of
#include <iostream> // std::cout
#include <string> // std::string
#include <cstddef> // std::size_t
int main ()
{
std::string str ("look for non-alphabetic characters...");
std::size_t found = str.find_first_not_of("abcdefghijklmnopqrstuvwxyz ");
if (found!=std::string::npos)
{
std::cout << "The first non-alphabetic character is " << str[found];
std::cout << " at position " << found << '\n';
}
return 0;
}
The first non-alphabetic character is - at position 12
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4