string::find_first_of

string (1)
size_t find_first_of (const string& str, size_t pos = 0) const noexcept;
c-string (2)
size_t find_first_of (const char* s, size_t pos = 0) const;
buffer (3)
size_t find_first_of (const char* s, size_t pos, size_t n) const;
character (4)
size_t find_first_of (char c, size_t pos = 0) const noexcept;

Function: Search the front of each character string in the back of a string

 

#include <iostream>
#include <string>
using namespace std;

main int ()
{
String S1 ( "abcdef");
String S2 ( "dgte");
size_t = n-s1.find_first_of (S2);
COUT n-<< << endl;
n-s1.find_first_of = (S2,. 4);
<< endl << n-COUT;
const char * S3 = "hijfkmn";
n-s1.find_first_of = (S3);
COUT n-<< << endl;
n-s1.find_first_of = (S3,. 3,. 4); // S3 the first four characters of the search is started from the position of the 3-character s1
COUT n-<< << endl;
n-s1.find_first_of = ( 'C', 3); // 3 (4th) starts at the top position of s1 'C'
COUT n-<< << endl;
return 0;
}

Guess you like

Origin www.cnblogs.com/xpylovely/p/12090712.html