📄 string2.html
字号:
<HTML><HEAD><TITLE><string></TITLE></HEAD><BODY><H1><A NAME="<string>"><CODE><string></CODE></A></H1><HR><P><B><CODE><A HREF="#string">string</A>· <A HREF="#char_allocator">char_allocator</A>· <A HREF="#char_traits">char_traits</A>· <A HREF="#getline">getline</A>· <A HREF="#operator+">operator+</A>· <A HREF="#operator!=">operator!=</A>· <A HREF="#operator==">operator==</A>· <A HREF="#operator<">operator<</A>· <A HREF="#operator<<">operator<<</A>· <A HREF="#operator<=">operator<=</A>· <A HREF="#operator>">operator></A>· <A HREF="#operator>=">operator>=</A>· <A HREF="#operator>>">operator>></A>· <A HREF="#swap">swap</A></CODE></B></P><HR><P>Include the standard header <B><CODE><string></CODE></B>to define theclass<A HREF="#string"><CODE>string</CODE></A> and varioussupporting classes and functions.</P><PRE> // DECLARATIONSclass <B><A HREF="#char_allocator">char_allocator</A></B>;class <B><A HREF="#char_traits">char_traits</A></B>;class <B><A HREF="#string">string</A></B>; // FUNCTIONSstring <B><A HREF="#operator+">operator+</A></B>( const string& left, const string& right);string <B><A HREF="#operator+">operator+</A></B>( const string& left, const char *right);string <B><A HREF="#operator+">operator+</A></B>( const string& left, char right);string <B><A HREF="#operator+">operator+</A></B>( const char *left, const string& right);string <B><A HREF="#operator+">operator+</A></B>( char left, const string& right);bool <B><A HREF="#operator==">operator==</A></B>( const string& left, const string& right);bool <B><A HREF="#operator==">operator==</A></B>( const string& left, const char *right);bool <B><A HREF="#operator==">operator==</A></B>( const char *left, const string& right);bool <B><A HREF="#operator!=">operator!=</A></B>( const string& left, const string& right);bool <B><A HREF="#operator!=">operator!=</A></B>( const string& left, const char *right);bool <B><A HREF="#operator!=">operator!=</A></B>( const char *left, const string& right);bool <B><A HREF="#operator<">operator<</A></B>( const string& left, const string& right);bool <B><A HREF="#operator<">operator<</A></B>( const string& left, const char *right);bool <B><A HREF="#operator<">operator<</A></B>( const char *left, const string& right);bool <B><A HREF="#operator>">operator></A></B>( const string& left, const string& right);bool <B><A HREF="#operator>">operator></A></B>( const string& left, const char *right);bool <B><A HREF="#operator>">operator></A></B>( const char *left, const string& right);bool <B><A HREF="#operator<=">operator<=</A></B>( const string& left, const string& right);bool <B><A HREF="#operator<=">operator<=</A></B>( const string& left, const char *right);bool <B><A HREF="#operator<=">operator<=</A></B>( const char *left, const string& right);bool <B><A HREF="#operator>=">operator>=</A></B>( const string& left, const string& right);bool <B><A HREF="#operator>=">operator>=</A></B>( const string& left, const char *right);bool <B><A HREF="#operator>=">operator>=</A></B>( const char *left, const string& right);void <B><A HREF="#swap">swap</A></B>( string& left, string& right);ostream& <B><A HREF="#operator<<">operator<<</A></B>( ostream& ostr, const string& str);istream& <B><A HREF="#operator>>">operator>></A></B>( istream& istr, string& str);istream& <B><A HREF="#getline">getline</A></B>( istream& istr, string& str);istream& <B><A HREF="#getline">getline</A></B>( istream& istr, string& str, char delim); // END OF DECLARATIONS</PRE><H2><A NAME="string"><CODE>string</CODE></A></H2><HR><P><B><CODE><A HREF="#string::string">string</A>· <A HREF="#string::allocator_type">allocator_type</A>· <A HREF="#string::append">append</A>· <A HREF="#string::assign">assign</A>· <A HREF="#string::at">at</A>· <A HREF="#string::begin">begin</A>· <A HREF="#string::c_str">c_str</A>· <A HREF="#string::capacity">capacity</A>· <A HREF="#string::clear">clear</A>· <A HREF="#string::compare">compare</A>· <A HREF="#string::const_iterator">const_iterator</A>· <A HREF="#string::const_pointer">const_pointer</A>· <A HREF="#string::const_reference">const_reference</A>· <A HREF="#string::const_reverse_iterator">const_reverse_iterator</A>· <A HREF="#string::copy">copy</A>· <A HREF="#string::data">data</A>· <A HREF="#string::difference_type">difference_type</A>· <A HREF="#string::empty">empty</A>· <A HREF="#string::end">end</A>· <A HREF="#string::erase">erase</A>· <A HREF="#string::find">find</A>· <A HREF="#string::find_first_not_of">find_first_not_of</A>· <A HREF="#string::find_first_of">find_first_of</A>· <A HREF="#string::find_last_not_of">find_last_not_of</A>· <A HREF="#string::find_last_of">find_last_of</A>· <A HREF="#string::get_allocator">get_allocator</A>· <A HREF="#string::insert">insert</A>· <A HREF="#string::iterator">iterator</A>· <A HREF="#string::length">length</A>· <A HREF="#string::max_size">max_size</A>· <A HREF="#string::npos">npos</A>· <A HREF="#string::operator+=">operator+=</A>· <A HREF="#string::operator=">operator=</A>· <A HREF="#string::operator[]">operator[]</A>· <A HREF="#string::pointer">pointer</A>· <A HREF="#string::push_back">push_back</A>· <A HREF="#string::rbegin">rbegin</A>· <A HREF="#string::reference">reference</A>· <A HREF="#string::rend">rend</A>· <A HREF="#string::replace">replace</A>· <A HREF="#string::reserve">reserve</A>· <A HREF="#string::resize">resize</A>· <A HREF="#string::reverse_iterator">reverse_iterator</A>· <A HREF="#string::rfind">rfind</A>· <A HREF="#string::size">size</A>· <A HREF="#string::size_type">size_type</A>· <A HREF="#string::substr">substr</A>· <A HREF="#string::swap">swap</A>· <A HREF="#string::traits_type">traits_type</A>· <A HREF="#string::value_type">value_type</A></CODE></B></P><HR><PRE>class <B>string</B> {public: typedef char_traits <B><A HREF="#string::traits_type">traits_type</A></B>; typedef char_allocator <B><A HREF="#string::allocator_type">allocator_type</A></B>; typedef T0 <B><A HREF="#string::iterator">iterator</A></B>; typedef T1 <B><A HREF="#string::const_iterator">const_iterator</A></B>; typedef T2 <B><A HREF="#string::size_type">size_type</A></B>; typedef T3 <B><A HREF="#string::difference_type">difference_type</A></B>; class <B><A HREF="#string::const_reverse_iterator">const_reverse_iterator</A></B>; class <B><A HREF="#string::reverse_iterator">reverse_iterator</A></B>; typedef allocator_type::pointer <B><A HREF="#string::pointer">pointer</A></B>; typedef allocator_type::const_pointer <B><A HREF="#string::const_pointer">const_pointer</A></B>; typedef allocator_type::reference <B><A HREF="#string::reference">reference</A></B>; typedef allocator_type::const_reference <B><A HREF="#string::const_reference">const_reference</A></B>; typedef allocator_type::value_type <B><A HREF="#string::value_type">value_type</A></B>; static const size_type <B><A HREF="#string::npos">npos</A></B> = -1; <B><A HREF="#string::string">string</A></B>(); explicit <B><A HREF="#string::string">string</A></B>(const allocator_type& al); <B><A HREF="#string::string">string</A></B>(const string& right); <B><A HREF="#string::string">string</A></B>(const string& right, size_type roff, size_type count = npos); <B><A HREF="#string::string">string</A></B>(const string& right, size_type roff, size_type count, const allocator_type& al); <B><A HREF="#string::string">string</A></B>(const value_type *ptr, size_type count); <B><A HREF="#string::string">string</A></B>(const value_type *ptr, size_type count, const allocator_type& al); <B><A HREF="#string::string">string</A></B>(const value_type *ptr); <B><A HREF="#string::string">string</A></B>(const value_type *ptr, const allocator_type& al); <B><A HREF="#string::string">string</A></B>(size_type count, value_type ch); <B><A HREF="#string::string">string</A></B>(size_type count, value_type ch, const allocator_type& al); <B><A HREF="#string::string">string</A></B>(const_iterator first, const_iterator last); <B><A HREF="#string::string">string</A></B>(const_iterator first, const_iterator last, const allocator_type& al); string& <B><A HREF="#string::operator=">operator=</A></B>(const string& right); string& <B><A HREF="#string::operator=">operator=</A></B>(const value_type *ptr); string& <B><A HREF="#string::operator=">operator=</A></B>(value_type ch); iterator <B><A HREF="#string::begin">begin</A></B>(); const_iterator <B><A HREF="#string::begin">begin</A></B>() const; iterator <B><A HREF="#string::end">end</A></B>(); const_iterator <B><A HREF="#string::end">end</A></B>() const; reverse_iterator <B><A HREF="#string::rbegin">rbegin</A></B>(); const_reverse_iterator <B><A HREF="#string::rbegin">rbegin</A></B>() const; reverse_iterator <B><A HREF="#string::rend">rend</A></B>(); const_reverse_iterator <B><A HREF="#string::rend">rend</A></B>() const; const_reference <B><A HREF="#string::at">at</A></B>(size_type off) const; reference <B><A HREF="#string::at">at</A></B>(size_type off); const_reference <B><A HREF="#string::operator[]">operator[]</A></B>(size_type off) const; reference <B><A HREF="#string::operator[]">operator[]</A></B>(size_type off); void <B><A HREF="#string::push_back">push_back</A></B>(value_type ch); const value_type *<B><A HREF="#string::c_str">c_str</A></B>() const; const value_type *<B><A HREF="#string::data">data</A></B>() const; size_type <B><A HREF="#string::length">length</A></B>() const; size_type <B><A HREF="#string::size">size</A></B>() const; size_type <B><A HREF="#string::max_size">max_size</A></B>() const; void <B><A HREF="#string::resize">resize</A></B>(size_type newsize, value_type ch = value_type()); size_type <B><A HREF="#string::capacity">capacity</A></B>() const; void <B><A HREF="#string::reserve">reserve</A></B>(size_type count = 0); bool <B><A HREF="#string::empty">empty</A></B>() const; string& <B><A HREF="#string::operator+=">operator+=</A></B>(const string& right); string& <B><A HREF="#string::operator+=">operator+=</A></B>(const value_type *ptr); string& <B><A HREF="#string::operator+=">operator+=</A></B>(value_type ch);</PRE><PRE> string& <B><A HREF="#string::append">append</A></B>(const string& right); string& <B><A HREF="#string::append">append</A></B>(const string& right, size_type roff, size_type count); string& <B><A HREF="#string::append">append</A></B>(const value_type *ptr, size_type count); string& <B><A HREF="#string::append">append</A></B>(const value_type *ptr); string& <B><A HREF="#string::append">append</A></B>(size_type count, value_type ch); string& <B><A HREF="#string::append">append</A></B>(const_iterator first, const_iterator last); string& <B><A HREF="#string::assign">assign</A></B>(const string& right); string& <B><A HREF="#string::assign">assign</A></B>(const string& right, size_type roff, size_type count); string& <B><A HREF="#string::assign">assign</A></B>(const value_type *ptr, size_type count); string& <B><A HREF="#string::assign">assign</A></B>(const value_type *ptr); string& <B><A HREF="#string::assign">assign</A></B>(size_type count, value_type ch); string& <B><A HREF="#string::assign">assign</A></B>(const_iterator first, const_iterator last); string& <B><A HREF="#string::insert">insert</A></B>(size_type off, const string& right); string& <B><A HREF="#string::insert">insert</A></B>(size_type off, const string& right, size_type roff, size_type count); string& <B><A HREF="#string::insert">insert</A></B>(size_type off, const value_type *ptr, size_type count); string& <B><A HREF="#string::insert">insert</A></B>(size_type off, const value_type *ptr); string& <B><A HREF="#string::insert">insert</A></B>(size_type off, size_type count, value_type ch); iterator <B><A HREF="#string::insert">insert</A></B>(iterator where, value_type ch = value_type()); void <B><A HREF="#string::insert">insert</A></B>(iterator where, size_type count, value_type ch); void <B><A HREF="#string::insert">insert</A></B>(iterator where, const_iterator first, const_iterator last); string& <B><A HREF="#string::erase">erase</A></B>(size_type off = 0, size_type count = npos); iterator <B><A HREF="#string::erase">erase</A></B>(iterator where); iterator <B><A HREF="#string::erase">erase</A></B>(iterator first, iterator last); void <B><A HREF="#string::clear">clear</A></B>(); string& <B><A HREF="#string::replace">replace</A></B>(size_type off, size_type n0, const string& right); string& <B><A HREF="#string::replace">replace</A></B>(size_type off, size_type n0, const string& right, size_type roff, size_type count); string& <B><A HREF="#string::replace">replace</A></B>(size_type off, size_type n0, const value_type *ptr, size_type count); string& <B><A HREF="#string::replace">replace</A></B>(size_type off, size_type n0, const value_type *ptr); string& <B><A HREF="#string::replace">replace</A></B>(size_type off, size_type n0, size_type count, value_type ch); string& <B><A HREF="#string::replace">replace</A></B>(iterator first, iterator last, const string& right); string& <B><A HREF="#string::replace">replace</A></B>(iterator first, iterator last, const value_type *ptr, size_type count); string& <B><A HREF="#string::replace">replace</A></B>(iterator first, iterator last, const value_type *ptr); string& <B><A HREF="#string::replace">replace</A></B>(iterator first, iterator last, size_type count, value_type ch); string& <B><A HREF="#string::replace">replace</A></B>(iterator first, iterator last, const_iterator first2, const_iterator last2); size_type <B><A HREF="#string::copy">copy</A></B>(value_type *ptr, size_type count, size_type off = 0) const;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -