⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 string.htm

📁 这是关于VC++中的STL容器的资料,包括了STL容器各个类之间关系以及类的说明
💻 HTM
📖 第 1 页 / 共 5 页
字号:

<h3>Description</h3>
<p>
The operator+=() appends the character <em>c</em> to the character sequence 
of the current object. The operator returns *this.
</p>

<hr>

<pre>
<a name="operator=1">
Method             operator=()</a>

Access             Public

Classification     Assignment Operator

Syntax             basic_string& operator=(const basic_string& str);

Parameters         <em>str</em> is the basic_string to be assigned to the
                   current object.

Returns            This operator returns a pointer to the calling object.

</pre>

<h3>Description</h3>
<p>
The operator=() assigns basic_string <em>str</em> to the current object. 
The operator returns *this.
</p>

<hr>

<pre>
<a name="operator=2">
Method             operator=()</a>

Access             Public

Classification     Assignment Operator

Syntax             basic_string& operator=(const charT* s);

Parameters         <em>s</em> points to a character array that is assigned to
                   the character sequence of the calling object.

Returns            This operator returns a pointer to the calling object.

</pre>

<h3>Description</h3>
<p>
The operator=() assigns the character array pointed to by <em>s</em> to the character sequence of the
current object. This method returns *this.
</p>

<hr>

<pre>
<a name="operator=3">
Method             operator=()</a>

Access             Public

Classification     Assignment Operator

Syntax             basic_string& operator=(charT c);

Parameters         <em>c</em> is the character to be assigned to the
                   character sequence of the current object.

Returns            This method returns a pointer to the calling object.

</pre>

<h3>Description</h3>
<p>
The operator=() assigns the character <em>c</em> to the character sequence of
the current object. The operator returns *this.
</p>

<hr>

<pre>
<a name="operator[]1">
Method             operator[]</a>

Access             Public

Classification     Subscript Operator

Syntax             const_reference operator[](size_type pos) const;

Parameters         <em>pos</em> is an index of the character sequence of the
                   current object.

Returns            This operator returns a const reference to a
                   character in the sequence.

</pre>

<h3>Description</h3>
<p>
The operator[] returns the const reference to the character at position <em>pos</em>. 
If pos == size() then traits::eos() is returned. The reference will be invalid after any
subsequent calls to c_str(), data() or any non-const member functions for the 
object.
</p>

<hr>

<pre>
<a name="operator[]2">
Method             operator[]</a>

Access             Public

Classification     Subscript Operator

Syntax             reference operator[](size_type pos);

Parameters         <em>pos</em> is an index of the character sequence of the
                   current object.

Returns            This operator returns a reference to a character 
                   in the sequence.

</pre>

<h3>Description</h3>
<p>
The operator[] returns the reference to the character at position <em>pos</em>.
If pos == size() then traits::eos() is returned. The reference will be invalid after any
subsequent calls to c_str(), data() or any non-const member functions for the
object.
</p>

<hr>

<pre>
<a name="append1">
Method             append()</a>

Access             Public

Classification     Modifier

Syntax             basic_string& append(const basic_string& str);

Parameters         <em>str</em> contains the character sequence that is to be
                   appended to the character sequence of the current
                   object.

Returns            This method returns a reference to a basic_string 
                   object initialized with the new character sequence.

</pre>

<h3>Description</h3>
<p>
This append() method appends the basic_string <em>str</em>'s character sequence
to the current object's character sequence. A basic_string object initialized 
with the new string is returned. An exception out_of_range is thrown if pos &gt; str.size(). 
An exception length_error is thrown if length of new string is greater than npos.
</p>

<hr>

<pre>
<a name="append2">
Method             append()</a>

Access             Public

Classification     Modifier

Syntax             basic_string& append(const basic_string& str,
                                        size_type pos,
                                        size_type n);

Parameters         <em>str</em> contains the character sequence to be appended
                   to the character sequence of the current object.

                   <em>pos</em> is the starting position to the sequence of the
                   basic_string str that is to be appended to the 
                   current object's character sequence.

                   <em>n</em> is the length of the appending sequence.

Returns            This method returns a reference to a basic_string
                   object initialized with the new character sequence.

</pre>

<h3>Description</h3>
<p>
This append() method appends the basic_string <em>str</em>'s character sequence 
starting at position <em>pos</em> with a length of <em>n</em> to the current 
object's character sequence. A basic_string object initialized with the new string is returned. An exception
out_of_range is thrown if pos &gt; str.size(). An exception length_error is
thrown if length of new string is greater than npos.
</p>

<hr>

<pre>
<a name="append3">
Method             append()</a>

Access             Public

Classification     Modifier

Syntax             basic_string& append(const charT* s, size_type n);

Parameters         <em>s</em> points to a character array that is appended to
                   the character sequence of the calling object. 

                   <em>n</em> is the length of the appending sequence.

Returns            This method returns a reference to a basic_string
                   object initialized with the new character sequence.

</pre>

<h3>Description</h3>
<p>
This append() method appends the character array pointed to by <em>s</em> 
with a length of <em>n</em> to the current object's
character sequence. A basic_string object initialized with the new string
is returned. An exception out_of_range is thrown if pos &gt; str.size(). An
exception length_error is thrown if length of new string is greater than npos.
</p>

<hr>

<pre>
<a name="append4">
Method             append()</a>

Access             Public

Classification     Modifier

Syntax             basic_string& append(const charT* s);

Parameters         <em>s</em> points to a character array that is appended to
                   the character sequence of the calling object.s

Returns            This method returns a reference to a basic_string
                   object initialized with the new character sequence.

</pre>

<h3>Description</h3>
<p>
This append() method appends the character array pointed to by <em>s</em> to 
the current object's character sequence. A basic_string object initialized 
with the new string is returned. An exception
out_of_range is thrown if pos > str.size(). An exception length_error is
thrown if length of new string is greater than npos.
</p>

<hr>

<pre>
<a name="append5">
Method             append()</a>

Access             Public

Classification     Modifier

Syntax             basic_string& append(size_type n, charT c);

Parameters         <em>n</em> is the number of characters to be appended.

                   <em>c</em> is the character to be appended to the
                   character sequence of the current object.

Returns            This method returns a reference to a basic_string
                   object initialized with the new character sequence.

</pre>

<h3>Description</h3>
<p>
This append() method appends <em>n</em> number of the character <em>c</em> to 
the current object's character sequence. A basic_string object initialized with 
the new string is returned. An exception out_of_range is thrown if pos &gt; str.size(). 
An exception length_error is thrown if length of new string is greater than npos.
</p>
<hr>

<pre>
<a name="append6">
Method             append()</a>

Access             Public

Classification     Modifier

Syntax             template<class InputIterator>
                   basic_string& append(InputIterator first, 
                                        InputIterator 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 a reference to a basic_string
                   object initialized with the new character sequence.

</pre>

<h3>Description</h3>
<p>
This append() method is a template function that appends a range specified 
by the input iterators <em>first</em> and <em>last</em> to the current object's 
character sequence. A basic_string object initialized with the new string is returned. 
An exception out_of_range is thrown if pos &gt; str.size(). An exception length_error is thrown if length
of new string is greater than npos.
</p>

<hr>

<pre>
<a name="assign1">
Method             assign()</a>

Access             Public

Classification     Modifier

Syntax             basic_string& assign(const basic_string& str);

Parameters         <em>str</em> is the basic_string object to be assigned
                   to the current object.

Returns            This method returns a pointer to the calling object.

</pre>

<h3>Description</h3>
<p>
This assign() method assigns the character sequence of the basic_string 
<em>str</em> to the character sequence of the current object. The method
returns *this.
</p>

<hr>

<pre>
<a name="assign2">
Method             assign()</a>

Access             Public

Classification     Modifier

Syntax             basic_string& assign(const basic_string& str,
                                        size_type pos,
                                        size_type n);

Parameters         <em>str</em> is the basic_string object to be assigned
                   to the current object.

                   <em>pos</em> is the starting position to the sequence of the
                   basic_string str that is to be assigned to the
                   current object's character sequence.

                   <em>n</em> is the length of the sequence to be assigned.

Returns            This method returns a pointer to the calling object.

</pre>


<h3>Description</h3>
<p>
This assign() method assigns the basic_string <em>str</em>'s character sequence
starting at position <em>pos</em> with a length of <em>n</em> to the current
object's character sequence. The method returns  *this.
An exception out_of_range is thrown if pos &gt; str.size(). 
</p>

<hr>

<pre>
<a name="assign3">
Method             assign()</a>

Access             Public

Classification     Modifier

Syntax             basic_string& assign(const charT* s,
                                        size_type n);

Parameters         <em>s</em> points to a character array that is assigned to
                   the character sequence of the calling object.

                   <em>n</em> is the length of the sequence to be assigned.


Returns            This method returns a pointer to the calling object.

</pre>

<h3>Description</h3>
<p>
This assign() method assigns the character array pointed to by <em>s</em>
with a length of <em>n</em> to the current object's character sequence.
This method returns *this.
</p>

<hr>

<pre>
<a name="assign4">
Method             assign()</a>

Access             Public

Classification     Modifier

Syntax             basic_string& assign(const charT* s);

Parameters         <em>s</em> points to a character array that is assigned to
                   the character sequence of the calling object.

Returns            This method returns a pointer to the calling object.

</pre>

<h3>Description</h3>
<p>
This assign() method assigns the character array pointed to by <em>s</em> to 
character sequence of the current object. The method returns *this.
</p>

<hr>

<pre>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -