名前空間
変種

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

提供: cppreference.com
2020年3月19日 (木) 04:52時点におけるFruderica (トーク | 投稿記録)による版
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
 
 
 
 
<tbody> </tbody>
constexpr size_type find(basic_string_view v, size_type pos = 0) const noexcept;
(1) (C++17以上)
constexpr size_type find(CharT ch, size_type pos = 0) const noexcept;
(2) (C++17以上)
constexpr size_type find(const CharT* s, size_type pos, size_type count) const;
(3) (C++17以上)
constexpr size_type find(const CharT* s, size_type pos = 0) const;
(4) (C++17以上)

指定された文字シーケンスと等しい最初の部分文字列を探します。

1) v がこのビュー内に現れる最初の位置を探します。 検索は位置 pos から開始されます。
2) find(basic_string_view(std::addressof(ch), 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())。

関連項目

部分文字列が現れる最後の位置を探します
(パブリックメンバ関数) [edit]
文字が現れる最初の位置を探します
(パブリックメンバ関数) [edit]
文字が現れる最後の位置を探します
(パブリックメンバ関数) [edit]
文字が現れない最初の位置を探します
(パブリックメンバ関数) [edit]
文字が現れない最後の位置を探します
(パブリックメンバ関数) [edit]