The differences between string::rfind() and string::find_last_of()
The difference between string::rfind() and string::find_last_of() is:
str.rfind("abc") finds the complete substring "abc" in reverse order
str.find_last_of("abc") finds any character of a/b/c from the end of str.
Is my understanding correct?
Well that would certainly be confusing...
Originally Posted by meili100
You could always try it and find out, but that's not the way I read it here:
If str is "abcabc", then rfind("abc") will return 3 and find_last_of("abc") will return 5. The difference between the two that I think you understand correctly is that find_last_of searches for any one of the characters provided, whereas rfind searches for the entire string provided.