📄 string.htm
字号:
Returns This method returns an iterator that points to the
character following the character position to be
erased.
</pre>
Return Type: iterator
<h3>Description</h3>
<p>
This erase() method removes the character pointed to by the iterator position. Returns the
iterator that points to the character following the character position
of the element that was erased. If that character does not exist
then end() is returned. The iterator position must be a valid iterator of the
current object. An exception out_of_range is thrown if pos > size().
</p>
<hr>
<pre>
<a name="erase3">
Method erase()</a>
Access Public
Classification Modifier
Syntax iterator erase(iterator first, iterator last);
Parameters <em>first</em> points to the beginning of a character
range.
<em>last</em> points to the end of a character range.
Returns This method returns the iterator that points to the
character following the character position of the
element that was erased.
</pre>
<h3>Description</h3>
<p>
This erase() method removes the characters in the range specified by the input
iterators <em>first</em> and <em>last</em>. This method returns the iterator that points to the character following the character
position of the element that was erased. If that character does not
exist then end() is returned. The iterators <em>first</em> and <em>last</em> must be valid
iterators of the current object.
</p>
<hr>
<pre>
<a name="find1">
Method find()</a>
Access Public
Classification Accessor
Syntax size_type find(const basic_string& str,
size_type pos = 0) const;
Parameters <em>str</em> contains the character sequence to be located in the
character sequence of the current object.
<em>pos</em> is the position in character sequence of the
current object to start the search.
Returns This method returns the position of the beginning
of the first occurence of the character
sequence of the basic_string object str in the
current object.
</pre>
<h3>Description</h3>
<p>
This find() method returns the position of the beginning of the first occurence
of the character sequence of the basic_string object <em>str</em> in the current object.
The search of the character sequence begins at position <em>pos</em> of the current
object. If the substring cannot be found npos is returned.
</p>
<hr>
<pre>
<a name="find2">
Method find()</a>
Access Public
Classification Accessor
Syntax size_type find(const charT* s, size_type pos,
size_type n) const;
Parameters <em>s</em> points to the character array to be located
in the character sequence of the current object.
<em>pos</em> is the position in the character sequence of the
current object to start the search.
<em>n</em> is the number of characters in the character
array to be located.
Returns This method returns the position of the beginning
of the first occurence of the first n characters
of the character array s in the character sequence
of the current object.
</pre>
<h3>Description</h3>
<p>
This find() method returns the position of the beginning of the first occurence of the first n
characters of the character array <em>s</em> in the character sequence of the
current object. The search of the character array begins at position
<em>pos</em> in the character sequence of the current object. If the
substring cannot be found npos is returned.
</p>
<hr>
<pre>
<a name="find3">
Method find()</a>
Access Public
Classification Accessor
Syntax size_type find(const charT* s,
size_type pos = 0) const;
Parameters <em>s</em> points to the character array to be located
in the character sequence of the current object.
<em>pos</em> is the position in the character sequence of the
current object to start the search.
Returns This method returns the position of the beginning
of the first occurence of the character array s in
the character sequence of the current object.
</pre>
<h3>Description</h3>
<p>
This find() method returns the position of the beginning of the first occurence
of the character array <em>s</em> in the current object. The search of the character
sequence begins at position <em>pos</em> of the character sequence of the
current object. If the substring cannot be found npos is returned.
</p>
<hr>
<pre>
<a name="find4">
Method find()</a>
Access Public
Classification Accessor
Syntax size_type find(const charT c, size_type pos = 0) const;
Parameters <em>c</em> is the character to be located.
<em>pos</em> is the position in the character sequence of the
current object to start the search.
Returns This method returns the position of the first occurence
of the character c in the current object.
</pre>
<h3>Description</h3>
<p>
Thsi find() method returns the position of the first occurence of the character
<em>c</em> in the character sequence of the current object. The search of the
character begins at position <em>pos</em> in the character sequence of the
current object. If the character cannot be found npos is returned.
</p>
<hr>
<pre>
<a name="find-first-not-of1">
Method find_first_not_of()</a>
Access Public
Classification Accessor
Syntax size_type find_first_not_of(const basic_string& str,
size_type pos = 0) const;
Parameters <em>str</em> contains the characters not located in the
character sequence of the current object.
<em>pos</em> is the position in character sequence of the
current object to start the search.
Returns This method returns the position in the current
object of the first occurence of any character
not in the character sequence of the basic_string
str.
</pre>
<h3>Description</h3>
<p>
This find_first_not_of() method returns the position in the current object
of the first occurence of any character not in the character sequence of the
basic_string <em>str</em>. The search of the character begins at position <em>pos</em>
of the current object. If the character cannot be found npos is returned.
</p>
<hr>
<pre>
<a name="find-first-not-of2">
Method find_first_not_of()</a>
Access Public
Classification Accessor
Syntax size_type find_first_not_of(const charT* s,
size_type pos,
size_type n) const;
Parameters <em>s</em> points to the character array not located
in the character sequence of the current object.
<em>pos</em> is the position in the character sequence of the
current object to start the search.
<em>n</em> is the length of the character array.
Returns This method returns the position in the character
sequence of the current object of the first
occurence of any character not in the character
array s.
</pre>
<h3>Description</h3>
<p>
This find_first_not_of() method returns the position in the character
sequence of the current object of the first occurence of any
character not in the character array <em>s</em> of length <em>n</em> .
The search of the character begins at position <em>pos</em> of the
character sequence of the current object. If the character
cannot be found npos is returned.
</p>
<hr>
<pre>
<a name="find-first-not-of3">
Method find_first_not_of()</a>
Access Public
Classification Accessor
Syntax size_type find_first_not_of(const charT* s,
size_type pos = 0) const;
Parameters <em>s</em> points to the character array not located
in the character sequence of the current object.
<em>pos</em> is the position in the character sequence of the
current object to start the search.
Returns This method returns the position in the current
object of the first occurence of any character not
in the character array s.
</pre>
<h3>Description</h3>
<p>
This find_first_not_of() method returns the position in the character
sequence of the current object of the first occurence of any character not
in the character array <em>s</em>. The search of the character begins at
position <em>pos</em> of the character sequence of the current object. If
the character cannot be found npos is returned.
</p>
<hr>
<pre>
<a name="find-first-not-of4">
Method find_first_not_of()</a>
Access Public
Classification Accessor
Syntax size_type find_first_not_of(const charT c,
size_type pos = 0) const;
Parameters <em>c</em> is the character not located in the
character sequence of the current object.
<em>pos</em> is the position in the character sequence of the
current object to start the search.
Returns This method returns the position in the current
object of the first occurence of a character that
is not c.
</pre>
<h3>Description</h3>
<p>
This find_first_not_of() method returns the position in the current object
of the first occurence of a character that is not <em>c</em>. The search of
the character begins at position <em>pos</em> of the character sequence of
the current object. If the character cannot be found npos is returned.
</p>
<hr>
<pre>
<a name="find-first-of1">
Method find_first_of()</a>
Access Public
Classification Accessor
Syntax size_type find_first_of(const basic_string& str,
size_type pos = 0) const;
Parameters <em>str</em> contains the characters located in the
character sequence of the current object.
<em>pos</em> is the position in character sequence of the
current object to start the search.
Returns This method returns the position in the character
sequence of the current object of the first
occurence of any character in the character
sequence of the basic_string str.
</pre>
<h3>Description</h3>
<p>
This find_first_of() method returns the position in the character sequence
of the current object of the first occurence of any character in the
character sequence of the basic_string <em>str</em>. The search of the
character begins at position <em>pos</em> of the current object. If the
character cannot be found npos is returned.
</p>
<hr>
<pre>
<a name="find-first-of2">
Method find_first_of()</a>
Access Public
Classification Accessor
Syntax size_type find_first_of(const charT* s,
size_type pos,
size_type n) const;
Parameters <em>s</em> points to the character array to be located
in the character sequence of the current object.
<em>pos</em> is the position in the character sequence of the
current object to start the search.
<em>n</em> is the length of the character array.
Returns This method returns the position in the character
sequence of the current object of the first occurence
of any character in the character array s of length n.
</pre>
<h3>Description</h3>
<p>
This find_first_of() method returns the position in the current object of
the first occurence of any character in the character array <em>s</em> of
length <em>n</em> . The search of the character begins at position <em>pos</em>
of the current object. If the character cannot be found npos is returned.
</p>
<hr>
<pre>
<a name="find-first-of3">
Method find_first_of()</a>
Access Public
Classification Accessor
Syntax size_type find_first_of(const charT* s,
size_type pos = 0) const;
Parameters <em>s</em> points to the character array to be located
in the character sequence of the current object.
<em>pos</em> is the position in the character sequence of the
current object to start the search.
Returns This method returns the position in the character
sequence of the current object of the first
occurence of any character in the character array s.
</pre>
<h3>Description</h3>
<p>
This find_first_of() method returns the position in the character sequence
current object of the first occurence of any character in the character
array <em>s</em>. The search of the character begins at
position <em>pos</em> of the current object. If the character cannot be found npos is
returned.
</p>
<hr>
<pre>
<a name="find-first-of4">
Method find_first_of()</a>
Access Public
Classification Accessor
Syntax size_type find_first_of(const charT c,
si
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -