Finding the Position of a Character or a String within Another String: find()
Syntax: position = source.find(string_to_find, start_position);
find takes two parameters: the string to find, and the starting position. It searches till the end of the string. find returns the position at which the item is found or string::npos if the item is not found. Reminder: find returns a value of type string::size_type, so declare the variable to hold the result that way.
Post A Comment:
0 comments: