string::find_last_of
查找指定字符串中存在的最后一个字符。
提要
std::size_t
find_last_of(
string_view sv,
std::size_t pos = string::npos) const noexcept;
描述
从 pos
向后搜索,查找此字符串中第一个等于 sv
中任何字符的字符。如果 pos
等于 npos
(默认值),则从最后一个字符开始搜索。
复杂度
线性复杂度,时间复杂度为 size()
+ sv.size()
。
异常安全性
无抛出保证。
返回值
找到的字符的索引,如果不存在则为 npos
。
参数
名称 | 描述 |
---|---|
|
要搜索的字符。 |
|
开始搜索的索引。 |