📄 basic_string.html
字号:
<pre>
template <class InputIterator>
basic_string& assign(InputIterator first, InputIterator last)
</pre>
</TD>
<TD VAlign=top>
<A href="Sequence.html">Sequence</A>
</TD>
<TD VAlign=top>
Erases the existing characters and replaces them by <tt>[first, last)</tt>
</TD>
</TR>
<TR>
<TD VAlign=top>
<pre>
basic_string& replace(size_type pos, size_type n,
const basic_string& s)
</pre>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Replaces a substring of <tt>*this</tt> with the string <tt>s</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<pre>
basic_string& replace(size_type pos, size_type n,
const basic_string& s,
size_type pos1, size_type n1)
</pre>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Replaces a substring of <tt>*this</tt> with a substring of <tt>s</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<pre>
basic_string& replace(size_type pos, size_type n,
const charT* s, size_type n1)
</pre>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Replaces a substring of <tt>*this</tt> with the first <tt>n1</tt> characters of <tt>s</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<pre>
basic_string& replace(size_type pos, size_type n,
const charT* s)
</pre>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Replaces a substring of <tt>*this</tt> with a null-terminated character array.
</TD>
</TR>
<TR>
<TD VAlign=top>
<pre>
basic_string& replace(size_type pos, size_type n,
size_type n1, charT c)
</pre>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Replaces a substring of <tt>*this</tt> with <tt>n1</tt> copies of <tt>c</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<pre>
basic_string& replace(iterator first, iterator last,
const basic_string& s)
</pre>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Replaces a substring of <tt>*this</tt> with the string <tt>s</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<pre>
basic_string& replace(iterator first, iterator last,
const charT* s, size_type n)
</pre>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Replaces a substring of <tt>*this</tt> with the first <tt>n</tt> characters of <tt>s</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<pre>
basic_string& replace(iterator first, iterator last,
const charT* s)
</pre>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Replaces a substring of <tt>*this</tt> with a null-terminated character array.
</TD>
</TR>
<TR>
<TD VAlign=top>
<pre>
basic_string& replace(iterator first, iterator last,
size_type n, charT c)
</pre>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Replaces a substring of <tt>*this</tt> with <tt>n</tt> copies of <tt>c</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<pre>
template <class InputIterator>
basic_string& replace(iterator first, iterator last,
InputIterator f, InputIterator l)
</pre>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Replaces a substring of <tt>*this</tt> with the range <tt>[f, l)</tt>
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>size_type copy(charT* buf, size_type n, size_type pos = 0) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Copies a substring of <tt>*this</tt> to a buffer.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>size_type find(const basic_string& s, size_type pos = 0) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Searches for <tt>s</tt> as a substring of <tt>*this</tt>, beginning at
character <tt>pos</tt> of <tt>*this</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>size_type find(const charT* s, size_type pos, size_type n) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Searches for the first <tt>n</tt> characters of <tt>s</tt> as a substring of <tt>*this</tt>, beginning at
character <tt>pos</tt> of <tt>*this</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>size_type find(const charT* s, size_type pos = 0) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Searches for a null-terminated character array as a substring of <tt>*this</tt>, beginning at
character <tt>pos</tt> of <tt>*this</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>size_type find(charT c, size_type pos = 0) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Searches for the character <tt>c</tt>, beginning at character position <tt>pos</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>size_type rfind(const basic_string& s, size_type pos = npos) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Searches backward for <tt>s</tt> as a substring of <tt>*this</tt>, beginning at
character position <tt>min(pos, size())</tt>
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>size_type rfind(const charT* s, size_type pos, size_type n) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Searches backward for the first <tt>n</tt> characters of <tt>s</tt> as a substring of <tt>*this</tt>, beginning at
character position <tt>min(pos, size())</tt>
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>size_type rfind(const charT* s, size_type pos = npos) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Searches backward for a null-terminated character array as a substring of <tt>*this</tt>, beginning at
character <tt>min(pos, size())</tt>
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>size_type rfind(charT c, size_type pos = npos) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Searches backward for the character <tt>c</tt>, beginning at character position <tt>min(pos, size()</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>size_type find_first_of(const basic_string& s, size_type pos = 0) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Searches within <tt>*this</tt>, beginning at <tt>pos</tt>, for the first character
that is equal to any character within <tt>s</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>size_type find_first_of(const charT* s, size_type pos, size_type n) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Searches within <tt>*this</tt>, beginning at <tt>pos</tt>, for the first character
that is equal to any character within the first <tt>n</tt> characters of <tt>s</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>size_type find_first_of(const charT* s, size_type pos = 0) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Searches within <tt>*this</tt>, beginning at <tt>pos</tt>, for the first character
that is equal to any character within <tt>s</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>size_type find_first_of(charT c, size_type pos = 0) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Searches within <tt>*this</tt>, beginning at <tt>pos</tt>, for the first character
that is equal to <tt>c</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>size_type find_first_not_of(const basic_string& s, size_type pos = 0) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Searches within <tt>*this</tt>, beginning at <tt>pos</tt>, for the first character
that is not equal to any character within <tt>s</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>size_type find_first_not_of(const charT* s, size_type pos, size_type n) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Searches within <tt>*this</tt>, beginning at <tt>pos</tt>, for the first character
that is not equal to any character within the first <tt>n</tt> characters of <tt>s</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>size_type find_first_not_of(const charT* s, size_type pos = 0) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Searches within <tt>*this</tt>, beginning at <tt>pos</tt>, for the first character
that is not equal to any character within <tt>s</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>size_type find_first_not_of(charT c, size_type pos = 0) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Searches within <tt>*this</tt>, beginning at <tt>pos</tt>, for the first character
that is not equal to <tt>c</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>size_type find_last_of(const basic_string& s, size_type pos = npos) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Searches backward within <tt>*this</tt>, beginning at <tt>min(pos, size())</tt>, for the first character
that is equal to any character within <tt>s</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>size_type find_last_of(const charT* s, size_type pos, size_type n) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Searches backward within <tt>*this</tt>, beginning at <tt>min(pos, size())</tt>, for the first character
that is equal to any character within the first <tt>n</tt> characters of <tt>s</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>size_type find_last_of(const charT* s, size_type pos = npos) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Searches backward <tt>*this</tt>, beginning at <tt>min(pos, size())</tt>, for the first character
that is equal to any character within <tt>s</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>size_type find_last_of(charT c, size_type pos = npos) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Searches backward <tt>*this</tt>, beginning at <tt>min(pos, size())</tt>, for the first character
that is equal to <tt>c</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>size_type find_last_not_of(const basic_string& s, size_type pos = npos) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Searches backward within <tt>*this</tt>, beginning at <tt>min(pos, size())</tt>, for the first character
that is not equal to any character within <tt>s</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>size_type find_last_not_of(const charT* s, size_type pos, size_type n) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Searches backward within <tt>*this</tt>, beginning at <tt>min(pos, size())</tt>, for the first character
that is not equal to any character within the first <tt>n</tt> characters of <tt>s</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>size_type find_last_not_of(const charT* s, size_type pos = npos) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Searches backward <tt>*this</tt>, beginning at <tt>min(pos, size())</tt>, for the first character
that is not equal to any character within <tt>s</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>size_type find_last_not_of(charT c, size_type pos = npos) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Searches backward <tt>*this</tt>, beginning at <tt>min(pos, size())</tt>, for the first character
that is not equal to <tt>c</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>basic_string substr(size_type pos = 0, size_type n = npos) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Returns a substring of <tt>*this</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>int compare(const basic_string& s) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Three-way lexicographical comparison of <tt>s</tt> and <tt>*this</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>int compare(size_type pos, size_type n, const basic_string& s) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Three-way lexicographical comparison of <tt>s</tt> and a substring of <tt>*this</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>int compare(size_type pos, size_type n, const basic_string& s, size_type pos1, size_type n1) const</tt>
</TD>
<TD VAlign=top>
<tt>basic_string</tt>
</TD>
<TD VAlign=top>
Three-way lexicographical comparison of a substring of <tt>s</tt> and a substring of <tt>*this</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>int compare(const charT* s) const</tt>
</TD>
<TD VAlign=top>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -