...

/

Search

Search

In this lesson, we'll examine the different search features available in the string class.

C++ offers many ways to search in a string. Each way exists in various overloaded forms.

ℹ️ Search is called find
It seems a bit odd but the algorithms for searching in a string start with the prefix “find”. If the search was successful, we get an index of type std::string::size_type, if not, we get the constant std::string::npos. The first character has the index 0. ...