... 41 cout << "\nfind_first_not_of(\"noon is 12 pm; midnight is not.\")"
42 << " returned: " << location << endl;
43 }
Original string: noon is 12 pm; midnight is not. (find) "is" was found at: 5 (rfind) "is" was found at: 24 (find_first_of) found 'o' from the group "misop" at: 1 (find_last_of) found 'o' from the group "misop" at: 28 (find_first_not_of) '1' is not contained in "noi spm" and was found at: 8 (find_first_not_of) '.' is not contained in "12noi spm" and was found at: 13 find_first_not_of("noon is 12 pm; midnight is not.") returned: -1
String string1
is declared and initialized in line 8. Line 13 attempts to find "is"
in string1
using function find
. If "is"
is found, the subscript of the starting location of that string is returned. ...
Get C++ How to Program, 10/e now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.