When pos is specified the search only includes characters on or before position pos, ignoring any content in the character positions after it.
Parameters
- str
- string containing the characters to match against in the object.
- s
- Array with a sequence of characters.
In the second member function version, the number of characters in the sequence of characters to match against is only determined by parameter n.
In the third version, a null-terminated sequence (c-string) is expected, and the amount of characters to match against is determined by its length, which is indicated by a null-character after the last character. - n
- Length of the sequence of characters s.
- c
- Individual character. The function returns the position of the last character in the object that is not c.
- pos
- Position of the last character in the string to be taken into consideration for matches. The default value npos indicates that the entire string is considered.
Return Value
The position of the last character in the object that is not part of characters it is being matched against.If no such position is found, the member value npos is returned.
Example
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
"erase trailing white-spaces" |
Basic template member declarations
( basic_string<charT,traits,Allocator> )| 1 2 3 4 5 6 7 8 |
|
See also
| string::find | Find content in string (public member function) |
| string::rfind | Find last occurrence of content in string (public member function) |
| string::find_last_of | Find character in string from the end (public member function) |
| string::find_first_not_of | Find absence of character in string |
| string::replace | Replace part of string (public member function) |
| string::substr | Generate substring (public member function) |
