| string (1) | size_type find_first_of (const basic_string& str, size_type pos = 0) const; |
|---|---|
| c-string (2) | size_type find_first_of (const charT* s, size_type pos = 0) const; |
| buffer (3) | size_type find_first_of (const charT* s, size_type pos, size_type n) const; |
| character (4) | size_type find_first_of (charT c, size_type pos = 0) const; |
| string (1) | size_type find_first_of (const basic_string& str, size_type pos = 0) const noexcept; |
|---|---|
| c-string (2) | size_type find_first_of (const charT* s, size_type pos = 0) const; |
| buffer (3) | size_type find_first_of (const charT* s, size_type pos, size_type n) const; |
| character (4) | size_type find_first_of (charT c, size_type pos = 0) const noexcept; |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// string::find_first_of
#include <iostream>
#include <string>
int main ()
{
std::string str ("PLease, replace the vowels in this sentence by asterisks.");
std::string::size_type found = str.find_first_of("aeiou");
while (found!=std::string::npos)
{
str[found]='*';
found=str.find_first_of("aeiou",found+1);
}
std::cout << str << '\n';
return 0;
}
Pl**s*, r*pl*c* th* v*w*ls *n th*s s*nt*nc* by *st*r*sks.