Boost C++ 库

...世界上最受推崇、设计最精良的 C++ 库项目之一。 Herb SutterAndrei Alexandrescu,《C++ Coding Standards

string::find_last_of - Boost C++ 函数库

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

参数

名称 描述

sv

要搜索的字符。

pos

开始搜索的索引。