148k views
1 vote
How to use the string find() in C++

User JBWhitmore
by
7.5k points

1 Answer

3 votes

Answer:

size_t find(const std::string& my_string, size_t pos = 0);

Step-by-step explanation:

We must invoke this on a string object, using another string as an argument.

The find() method will then check if the given string lies in our string. It will return the size of the sub-string including the '\0' terminating character (as size_t). But if the string does not lie in our original string, it will return 0.

User Karelv
by
6.9k points