previous | start | next

C++ string: find member functions

The find member of the string class finds the position in a string of another string or character. There are several versions of find. E.g. to find a string str as a substring of a string s:

Note 1: The position of the first character of a string is 0.

Note 2: If the string or character specified is not found, the return value is a special value defined in the string class:

string::npos
      
   

This value is the largest (unsigned) integer value.



previous | start | next