c ++ find function and count functions

algorithml 1 of the find, there is a string of find

For the first call of its form

find(start,end,value)

Starting point start searching, the end end of the search, looking for value value

Representation of container

find(a.begin(),a.end(),value)

(When using the find of iterators, remember to define an iterator advance ,,, because the find returns a pointer type)

Representation of the array

find(a,a+length,value)

If you find the value returned is the address if the address is not found return a + length or a.end within the scope of the find ()

string in the find () function finds the first occurrence of the target string. If not, then return s.npos

/// / Find function return types size_type 
    String s ( " 1a2b3c4d5e6f7jkg8h9i1a2b3c4d5e6f7g8ha9i " );
     String In Flag;
     String :: size_type position;
     // Find function returns the subscript jk position in s 
    position s.find = ( " jk " );
     IF (! = position s.npos)   // If not found, returns a special symbol c ++ using npos said, I am here npos value is 4294967295, 
    { 
        printf ( " position iS:% d \ the n- " , position); 
    }

 

Guess you like

Origin www.cnblogs.com/Accepting/p/11222981.html