std::experimental::basic_string_view<CharT,Traits>:: find
From cppreference.net
<
cpp
|
experimental
|
basic string view
|
constexpr
size_type find
(
basic_string_view v, size_type pos
=
0
)
const
noexcept
;
|
(1) | (库基础技术规范) |
|
constexpr
size_type find
(
CharT c, size_type pos
=
0
)
const
noexcept
;
|
(2) | (库基础技术规范) |
|
constexpr
size_type find
(
const
CharT
*
s, size_type pos, size_type count
)
const
;
|
(3) | (库基础技术规范) |
|
constexpr
size_type find
(
const
CharT
*
s, size_type pos
=
0
)
const
;
|
(4) | (库基础技术规范) |
查找与给定字符序列相等的首个子串。
1)
从位置
pos
开始查找本视图中首次出现的
v
。
2)
等价于
find
(
basic_string_view
(
&
c,
1
)
, pos
)
。
3)
等价于
find
(
basic_string_view
(
s, count
)
, pos
)
。
4)
等价于
find
(
basic_string_view
(
s
)
, pos
)
。
目录 |
参数
| v | - | 要搜索的视图 |
| pos | - | 开始搜索的位置 |
| count | - | 要搜索的子串长度 |
| s | - | 要搜索的字符串指针 |
| ch | - | 要搜索的字符 |
返回值
找到的子串首字符位置,若未找到该子串则返回 npos 。
复杂度
最坏情况下时间复杂度为 O(
size()
*
v.size()
)。
参见
|
查找子串的最后一次出现
(公共成员函数) |
|
|
查找字符的首次出现
(公共成员函数) |
|
|
查找字符的最后一次出现
(公共成员函数) |
|
|
查找字符的首次缺失
(公共成员函数) |
|
|
查找字符的最后一次缺失
(公共成员函数) |