|
1109 | 1109 | int compare(const charT* s) const;
|
1110 | 1110 | int compare(size_type pos1, size_type n1, const charT* s) const;
|
1111 | 1111 | int compare(size_type pos1, size_type n1, const charT* s, size_type n2) const;
|
| 1112 | + |
| 1113 | + bool starts_with(basic_string_view<charT, traits> x) const noexcept; |
| 1114 | + bool starts_with(charT x) const noexcept; |
| 1115 | + bool starts_with(const charT* x) const; |
| 1116 | + bool ends_with(basic_string_view<charT, traits> x) const noexcept; |
| 1117 | + bool ends_with(charT x) const noexcept; |
| 1118 | + bool ends_with(const charT* x) const; |
1112 | 1119 | };
|
1113 | 1120 |
|
1114 | 1121 | template<class InputIterator,
|
|
3677 | 3684 | \returns \tcode{basic_string(*this, pos, n1).compare(basic_string(s, n2))}.
|
3678 | 3685 | \end{itemdescr}
|
3679 | 3686 |
|
| 3687 | +\rSec4[string.starts.with]{\tcode{basic_string::starts_with}} |
| 3688 | + |
| 3689 | +\indexlibrarymember{starts_with}{basic_string}% |
| 3690 | +\begin{itemdecl} |
| 3691 | +bool starts_with(basic_string_view<charT, traits> x) const noexcept; |
| 3692 | +bool starts_with(charT x) const noexcept; |
| 3693 | +bool starts_with(const charT* x) const; |
| 3694 | +\end{itemdecl} |
| 3695 | + |
| 3696 | +\begin{itemdescr} |
| 3697 | +\pnum |
| 3698 | +\effects |
| 3699 | +Equivalent to: |
| 3700 | +\begin{codeblock} |
| 3701 | +return basic_string_view<charT, traits>(data(), size()).starts_with(x); |
| 3702 | +\end{codeblock} |
| 3703 | +\end{itemdescr} |
| 3704 | + |
| 3705 | +\rSec4[string.ends.with]{\tcode{basic_string::ends_with}} |
| 3706 | + |
| 3707 | +\indexlibrarymember{ends_with}{basic_string}% |
| 3708 | +\begin{itemdecl} |
| 3709 | +bool ends_with(basic_string_view<charT, traits> x) const noexcept; |
| 3710 | +bool ends_with(charT x) const noexcept; |
| 3711 | +bool ends_with(const charT* x) const; |
| 3712 | +\end{itemdecl} |
| 3713 | + |
| 3714 | +\begin{itemdescr} |
| 3715 | +\pnum |
| 3716 | +\effects |
| 3717 | +Equivalent to: |
| 3718 | +\begin{codeblock} |
| 3719 | +return basic_string_view<charT, traits>(data(), size()).ends_with(x); |
| 3720 | +\end{codeblock} |
| 3721 | +\end{itemdescr} |
| 3722 | + |
3680 | 3723 | \rSec2[string.nonmembers]{\tcode{basic_string} non-member functions}
|
3681 | 3724 |
|
3682 | 3725 | \indexlibrary{\idxcode{basic_string}}
|
|
4703 | 4746 | constexpr int compare(size_type pos1, size_type n1, const charT* s) const;
|
4704 | 4747 | constexpr int compare(size_type pos1, size_type n1, const charT* s, size_type n2) const;
|
4705 | 4748 |
|
| 4749 | + constexpr bool starts_with(basic_string_view x) const noexcept; |
| 4750 | + constexpr bool starts_with(charT x) const noexcept; |
| 4751 | + constexpr bool starts_with(const charT* x) const; |
| 4752 | + constexpr bool ends_with(basic_string_view x) const noexcept; |
| 4753 | + constexpr bool ends_with(charT x) const noexcept; |
| 4754 | + constexpr bool ends_with(const charT* x) const; |
| 4755 | + |
4706 | 4756 | constexpr size_type find(basic_string_view s, size_type pos = 0) const noexcept;
|
4707 | 4757 | constexpr size_type find(charT c, size_type pos = 0) const noexcept;
|
4708 | 4758 | constexpr size_type find(const charT* s, size_type pos, size_type n) const;
|
|
5205 | 5255 | Equivalent to: \tcode{return substr(pos1, n1).compare(basic_string_view(s, n2));}
|
5206 | 5256 | \end{itemdescr}
|
5207 | 5257 |
|
| 5258 | +\indexlibrarymember{starts_with}{basic_string_view}% |
| 5259 | +\begin{itemdecl} |
| 5260 | +constexpr bool starts_with(basic_string_view x) const noexcept; |
| 5261 | +\end{itemdecl} |
| 5262 | + |
| 5263 | +\begin{itemdescr} |
| 5264 | +\pnum |
| 5265 | +\effects |
| 5266 | +Equivalent to: \tcode{return compare(0, npos, x) == 0;} |
| 5267 | +\end{itemdescr} |
| 5268 | + |
| 5269 | +\indexlibrarymember{starts_with}{basic_string_view}% |
| 5270 | +\begin{itemdecl} |
| 5271 | +constexpr bool starts_with(charT x) const noexcept; |
| 5272 | +\end{itemdecl} |
| 5273 | + |
| 5274 | +\begin{itemdescr} |
| 5275 | +\pnum |
| 5276 | +\effects |
| 5277 | +Equivalent to: \tcode{return starts_with(basic_string_view(\&x, 1));} |
| 5278 | +\end{itemdescr} |
| 5279 | + |
| 5280 | +\indexlibrarymember{starts_with}{basic_string_view}% |
| 5281 | +\begin{itemdecl} |
| 5282 | +constexpr bool starts_with(const charT* x) const; |
| 5283 | +\end{itemdecl} |
| 5284 | + |
| 5285 | +\begin{itemdescr} |
| 5286 | +\pnum |
| 5287 | +\effects |
| 5288 | +Equivalent to: \tcode{return starts_with(basic_string_view(x));} |
| 5289 | +\end{itemdescr} |
| 5290 | + |
| 5291 | +\indexlibrarymember{ends_with}{basic_string_view}% |
| 5292 | +\begin{itemdecl} |
| 5293 | +constexpr bool ends_with(basic_string_view x) const noexcept; |
| 5294 | +\end{itemdecl} |
| 5295 | + |
| 5296 | +\begin{itemdescr} |
| 5297 | +\pnum |
| 5298 | +\effects |
| 5299 | +Equivalent to: |
| 5300 | +\begin{codeblock} |
| 5301 | +return size() >= x.size() && compare(size() - x.size(), npos, x) == 0; |
| 5302 | +\end{codeblock} |
| 5303 | +\end{itemdescr} |
| 5304 | + |
| 5305 | +\indexlibrarymember{ends_with}{basic_string_view}% |
| 5306 | +\begin{itemdecl} |
| 5307 | +constexpr bool ends_with(charT x) const noexcept; |
| 5308 | +\end{itemdecl} |
| 5309 | + |
| 5310 | +\begin{itemdescr} |
| 5311 | +\pnum |
| 5312 | +\effects |
| 5313 | +Equivalent to: \tcode{return ends_with(basic_string_view(\&x, 1));} |
| 5314 | +\end{itemdescr} |
| 5315 | + |
| 5316 | +\indexlibrarymember{ends_with}{basic_string_view}% |
| 5317 | +\begin{itemdecl} |
| 5318 | +constexpr bool ends_with(const charT* x) const; |
| 5319 | +\end{itemdecl} |
| 5320 | + |
| 5321 | +\begin{itemdescr} |
| 5322 | +\pnum |
| 5323 | +\effects |
| 5324 | +Equivalent to: \tcode{return ends_with(basic_string_view(x));} |
| 5325 | +\end{itemdescr} |
| 5326 | + |
5208 | 5327 | \rSec3[string.view.find]{Searching}
|
5209 | 5328 |
|
5210 | 5329 | \pnum
|
|
0 commit comments