📄 string2.html
字号:
length</LI><LI>a positive value otherwise</LI></UL><H3><CODE><A NAME="string::const_iterator">string::const_iterator</A></CODE></H3><PRE>typedef T1 <B>const_iterator</B>;</PRE><P>The type describes an object that can serve as a constantrandom-access iterator for the controlled sequence.It is described here as asynonym for the implementation-defined type <CODE>T1</CODE>.</P><H3><CODE><A NAME="string::const_pointer">string::const_pointer</A></CODE></H3><PRE>typedef allocator_type::const_pointer <B>const_pointer</B>;</PRE><P>The type is a synonym for <CODE>allocator_type::const_pointer</CODE>.</P><H3><CODE><A NAME="string::const_reference">string::const_reference</A></CODE></H3><PRE>typedef allocator_type::const_reference <B>const_reference</B>;</PRE><P>The type is a synonym for <CODE>allocator_type::const_reference</CODE>.</P><H3><CODE><A NAME="string::const_reverse_iterator">string::const_reverse_iterator</A></CODE></H3><PRE>class <B>const_reverse_iterator</B>;</PRE><P>The type describes an object that can serve as a constant reverseiterator for the controlled sequence. You can, for example, access each ofthe elements in the controlled sequence in reverse order by writing:</P><PRE> string::const_reverse_iterator rit; for (rit = rbegin(); rit != rend(); ++rit) <B>process *rit</B></PRE><H3><CODE><A NAME="string::copy">string::copy</A></CODE></H3><PRE>size_type <B>copy</B>(value_type *ptr, size_type count, size_type off = 0) const;</PRE><P>The member function copies up to <CODE>count</CODE> elements from thecontrolled sequence, beginning at position <CODE>off</CODE>, to thearray of <CODE>value_type</CODE> beginning at <CODE>ptr</CODE>. It returns thenumber of elements actually copied.</P><H3><CODE><A NAME="string::data">string::data</A></CODE></H3><PRE>const value_type <B>*data</B>() const;</PRE><P>The member function returns a pointer to the first elementof the sequence (or, for an empty sequence, a non-null pointerthat cannot be dereferenced).</P><H3><CODE><A NAME="string::difference_type">string::difference_type</A></CODE></H3><PRE>typedef T3 <B>difference_type</B>;</PRE><P>The signed integer type describes an object that can represent thedifference between the addresses of any two elements in the controlledsequence. It is described here as asynonym for the implementation-defined type <CODE>T3</CODE>.</P><H3><CODE><A NAME="string::empty">string::empty</A></CODE></H3><PRE>bool <B>empty</B>() const;</PRE><P>The member function returns true for an empty controlled sequence.</P><H3><CODE><A NAME="string::end">string::end</A></CODE></H3><PRE>const_iterator <B>end</B>() const;iterator <B>end</B>();</PRE><P>The member functions each return a random-access iterator that pointsjust beyond the end of the sequence.</P><H3><CODE><A NAME="string::erase">string::erase</A></CODE></H3><PRE>iterator <B>erase</B>(iterator first, iterator last);iterator <B>erase</B>(iterator where);string& <B>erase</B>(size_type off = 0, size_type count = npos);</PRE><P>The first member function removes the elements of the controlledsequence in the range <CODE>[first, last)</CODE>.The second member function removes the element of the controlledsequence pointed to by <CODE>where</CODE>.Both return an iterator that designates the first element remainingbeyond any elements removed, or<CODE><A HREF="#string::end">end</A>()</CODE>if no such element exists.</P><P>The third member function removes up to <CODE>count</CODE> elements ofthe controlled sequence beginning at position <CODE>off</CODE>, thenreturns <CODE>*this</CODE>.</P><H3><CODE><A NAME="string::find">string::find</A></CODE></H3><PRE>size_type <B>find</B>(value_type ch, size_type off = 0) const;size_type <B>find</B>(const value_type *ptr, size_type off = 0) const;size_type <B>find</B>(const value_type *ptr, size_type off, size_type count) const;size_type <B>find</B>(const string& right, size_type off = 0) const;</PRE><P>The member functions each find the first (lowest beginning position)subsequence in the controlled sequence, beginning on or after position<CODE>off</CODE>, that matches the<A HREF="#operand sequence">operand sequence</A> specified by theremaining operands. If it succeeds, it returns the position where thematching subsequence begins. Otherwise, the function returns<CODE><A HREF="#string::npos">npos</A></CODE>.</P><H3><CODE><A NAME="string::find_first_not_of">string::find_first_not_of</A></CODE></H3><PRE>size_type <B>find_first_not_of</B>(value_type ch, size_type off = 0) const;size_type <B>find_first_not_of</B>(const value_type *ptr, size_type off = 0) const;size_type <B>find_first_not_of</B>(const value_type *ptr, size_type off, size_type count) const;size_type <B>find_first_not_of</B>(const string& right, size_type off = 0) const;</PRE><P>The member functions each find the first (lowest position) element of thecontrolled sequence, at or after position <CODE>off</CODE>, thatmatches <I>none</I> of the elements in the<A HREF="#operand sequence">operand sequence</A> specified by theremaining operands. If it succeeds, it returns the position. Otherwise,the function returns<CODE><A HREF="#string::npos">npos</A></CODE>.</P><H3><CODE><A NAME="string::find_first_of">string::find_first_of</A></CODE></H3><PRE>size_type <B>find_first_of</B>(value_type ch, size_type off = 0) const;size_type <B>find_first_of</B>(const value_type *ptr, size_type off = 0) const;size_type <B>find_first_of</B>(const value_type *ptr, size_type off, size_type count) const;size_type <B>find_first_of</B>(const string& right, size_type off = 0) const;</PRE><P>The member functions each find the first (lowest position) element of thecontrolled sequence, at or after position <CODE>off</CODE>, thatmatches <I>any</I> of the elements in the<A HREF="#operand sequence">operand sequence</A> specified by theremaining operands. If it succeeds, it returns the position. Otherwise,the function returns<CODE><A HREF="#string::npos">npos</A></CODE>.</P><H3><CODE><A NAME="string::find_last_not_of">string::find_last_not_of</A></CODE></H3><PRE>size_type <B>find_last_not_of</B>(value_type ch, size_type off = npos) const;size_type <B>find_last_not_of</B>(const value_type *ptr, size_type off = npos) const;size_type <B>find_last_not_of</B>(const value_type *ptr, size_type off, size_type count) const;size_type <B>find_last_not_of</B>(const string& right, size_type off = npos) const;</PRE><P>The member functions each find the last (highest position) element of thecontrolled sequence, at or before position <CODE>off</CODE>, thatmatches <I>none</I> of the elements in the<A HREF="#operand sequence">operand sequence</A> specified by theremaining operands. If it succeeds, it returns the position. Otherwise,the function returns<CODE><A HREF="#string::npos">npos</A></CODE>.</P><H3><CODE><A NAME="string::find_last_of">string::find_last_of</A></CODE></H3><PRE>size_type <B>find_last_of</B>(value_type ch, size_type off = npos) const;size_type <B>find_last_of</B>(const value_type *ptr, size_type off = npos) const;size_type <B>find_last_of</B>(const value_type *ptr, size_type off, size_type count = npos) const;size_type <B>find_last_of</B>(const string& right, size_type off = npos) const;</PRE><P>The member functions each find the last (highest position) element of thecontrolled sequence, at or before position <CODE>off</CODE>, thatmatches <I>any</I> of the elements in the<A HREF="#operand sequence">operand sequence</A> specified by theremaining operands. If it succeeds, it returns the position. Otherwise,the function returns<CODE><A HREF="#string::npos">npos</A></CODE>.</P><H3><CODE><A NAME="string::get_allocator">string::get_allocator</A></CODE></H3><PRE>allocator_type <B>get_allocator</B>() const;</PRE><P>The member function returns the stored<A HREF="#allocator object">allocator object</A>.</P><H3><CODE><A NAME="string::insert">string::insert</A></CODE></H3><PRE>string& <B>insert</B>(size_type off, const value_type *ptr);string& <B>insert</B>(size_type off, const value_type *ptr, size_type count);string& <B>insert</B>(size_type off, const string& right);string& <B>insert</B>(size_type off, const string& right, size_type roff, size_type count);string& <B>insert</B>(size_type off, size_type count, value_type ch);iterator <B>insert</B>(iterator where, value_type ch = value_type());void <B>insert</B>(iterator where, const_iterator first, const_iterator last);void <B>insert</B>(iterator where, size_type count, value_type ch);</PRE><P>The member functions each insert, before position <CODE>off</CODE> orbefore the element pointed to by <CODE>where</CODE> in the controlledsequence, the<A HREF="#operand sequence">operand sequence</A> specified by theremaining operands. A function that returns a value returns<CODE>*this</CODE>.</P><H3><CODE><A NAME="string::iterator">string::iterator</A></CODE></H3><PRE>typedef T0 <B>iterator</B>;</PRE><P>The type describes an object that can serve as a random-accessiterator for the controlled sequence.It is described here as asynonym for the implementation-defined type <CODE>T0</CODE>.</P><H3><CODE><A NAME="string::length">string::length</A></CODE></H3><PRE>size_type <B>length</B>() const;</PRE><P>The member function returns the length of the controlled sequence(same as <CODE><A HREF="#string::size">size</A>()</CODE>).</P><H3><CODE><A NAME="string::max_size">string::max_size</A></CODE></H3><PRE>size_type <B>max_size</B>() const;</PRE><P>The member function returns the length of the longest sequence thatthe object can control.</P><H3><CODE><A NAME="string::npos">string::npos</A></CODE></H3><PRE>static const size_type <B>npos</B> = -1;</PRE><P>The constant is the largest representable value of type<A HREF="#string::size_type"><CODE>size_type</CODE></A>. It isassuredly larger than<CODE><A HREF="#string::max_size">max_size</A>()</CODE>, henceit serves as either a very large value or as a special code.</P><H3><CODE><A NAME="string::operator+=">string::operator+=</A></CODE></H3><PRE>string& <B>operator+=</B>(value_type ch);string& <B>operator+=</B>(const value_type *ptr);string& <B>operator+=</B>(const string& right);</PRE><P>The operators each append the<A HREF="#operand sequence">operand sequence</A> to the end of thesequence controlled by <CODE>*this</CODE>, then return <CODE>*this</CODE>.</P><H3><CODE><A NAME="string::operator=">string::operator=</A></CODE></H3><PRE>string& <B>operator=</B>(value_type ch);string& <B>operator=</B>(const value_type *ptr);string& <B>operator=</B>(const string& right);</PRE><P>The operators each replace the sequence controlled by <CODE>*this</CODE>with the<A HREF="#operand sequence">operand sequence</A>,then return <CODE>*this</CODE>.</P><H3><CODE><A NAME="string::operator[]">string::operator[]</A></CODE></H3><PRE>const_reference <B>operator[]</B>(size_type off) const;reference <B>operator[]</B>(size_type off);</PRE><P>The member functions each return a reference to the element of thecontrolled sequence at position <CODE>off</CODE>. If that position isinvalid, the behavior is undefined. Note, however, that<CODE>cstr[cstr.size()] == 0</CODE> for the first member function.</P><H3><CODE><A NAME="string::pointer">string::pointer</A></CODE></H3><PRE>typedef allocator_type::pointer <B>pointer</B>;</PRE><P>The type is a synonym for <CODE>allocator_type::pointer</CODE>.</P><H3><CODE><A NAME="string::push_back">string::push_back</A></CODE></H3><PRE>void <B>push_back</B>(value_type ch);</PRE><P>The member function effectively calls<CODE><A HREF="#string::insert">insert</A>(<A HREF="#string::end">end</A>(), ch)</CODE>.</P><H3><CODE><A NAME="string::rbegin">string::rbegin</A></CODE></H3><PRE>const_reverse_iterator <B>rbegin</B>() const;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -