std::basic_string_view<CharT,Traits>::find_first_of

来自cppreference.com
Fruderica留言 | 贡献2017年2月7日 (二) 05:10的版本 (以“{{cpp/string/basic_string_view/title | find_first_of }} {{cpp/string/basic_string_view/navbar}} {{dcl begin}} {{dcl | num=1 | since=c++17 | constexpr size_type find_...”为内容创建页面)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
 
 
 
 
constexpr size_type find_first_of(basic_string_view v, size_type pos = 0) const;
(1) (C++17 起)
constexpr size_type find_first_of(CharT c, size_type pos = 0) const;
(2) (C++17 起)
constexpr size_type find_first_of(const CharT* s, size_type pos, size_type count) const;
(3) (C++17 起)
constexpr size_type find_first_of(const CharT* s, size_type pos = 0) const;
(4) (C++17 起)

查找首个等于给定字符序列中任意字符的字符。

1) 查找v的任意字符在此视图中的首次出现,从位置pos开始。
2) 等价于find_first_of(basic_string_view(&c, 1), pos)
3) 等价于find_first_of(basic_string_view(s, count), pos)
4) 等价于find_first_of(basic_string_view(s), pos)

参数

v - 要查找的视图
pos - 要开始查找的位置
count - 要查找的字符串的长度
s - 指向要查找的字符串的指针
ch - 要查找的字符

返回值

子串的任意字符的首次出现位置,或者若找不到这些字符则为npos

异常

1-2)

noexcept 说明:  
noexcept
  

复杂度

最坏情况为O(size() * v.size())。

参阅

在视图中查找字符
(公开成员函数) [编辑]
寻找子串的最后一次出现
(公开成员函数) [编辑]
查找字符的最后一次出现
(公开成员函数) [编辑]
查找字符的首次不出现
(公开成员函数) [编辑]
查找字符的最后一次不出现
(公开成员函数) [编辑]