The find method is passed using either a character, a C string, or a C++ string, and you can provide an initial search position to start the search. The find method returns the position (rather than an iterator) to where the search text was located, or a value of npos if the text cannot be found. The offset parameter, and a successful return value from the find method, enables you to parse a string repeatedly to find specific items. The find method searches for the specified text in the forward direction, and there is also an rfind method that performs the search in the reverse direction.
Note that rfind is not the complete opposite of the find method. The find method moves the search point forward in the string and at each ...