摘要:        
const char* c_str() const noexcept;功能:返回c风格字符转 #include <iostream>#include <string>#include <cstring>using namespace std; int main(){ string s1("i lov    阅读全文
posted @ 2019-12-23 19:04
MoonXu
阅读(156)
评论(0)
推荐(0)
        
            
        
        
摘要:        
const_reverse_iterator crbegin() const noexcept;功能:crbegin是最后一个字符,crend第一个字符的前一个。迭代器向左移动是“+”,向右移动是“-” #include <iostream>#include <string> using names    阅读全文
posted @ 2019-12-23 18:15
MoonXu
阅读(342)
评论(0)
推荐(0)
        
            
        
        
摘要:        
size_t copy (char* s, size_t len, size_t pos = 0) const;功能:把string的pos位置开始的len字节copy到s注意:s的最后要手动添加字符串结束标志 #include <iostream>#include <string> using n    阅读全文
posted @ 2019-12-23 18:03
MoonXu
阅读(484)
评论(0)
推荐(0)
        
            
        
        
摘要:        
void clear() noexcept;功能:把string对象置为空 #include <iostream>#include <string> using namespace std; int main(){ char c; string str; cout << "please enter     阅读全文
posted @ 2019-12-23 17:41
MoonXu
阅读(221)
评论(0)
推荐(0)
        
            
        
        
摘要:        
const_iterator cbegin() const noexcept; const_iterator cend() const noexcept;注:返回常量迭代器,不能修改 #include <iostream>#include <string> using namespace std;     阅读全文
posted @ 2019-12-23 15:21
MoonXu
阅读(499)
评论(0)
推荐(0)
        
            
        
        
摘要:        
size_t capacity() const noexcept; #include <iostream>#include <string> using namespace std; int main(){ string s1("hello"); cout << "capacity:" << s1.    阅读全文
posted @ 2019-12-23 13:39
MoonXu
阅读(235)
评论(0)
推荐(0)
        
            
        
        
摘要:        
iterator begin() noexcept; const_iterator begin() const noexcept; iterator end() noexcept; const_iterator end() const noexcept; #include <iostream>#in    阅读全文
posted @ 2019-12-23 13:24
MoonXu
阅读(205)
评论(0)
推荐(0)
        
            
        
        
摘要:        
char& back(); const char& back() const; #include <iostream>#include <string> using namespace std;int main(){ string s1("hello"); cout << s1.back() <<     阅读全文
posted @ 2019-12-23 13:18
MoonXu
阅读(192)
评论(0)
推荐(0)
        
            
        
        
摘要:        
char& at (size_t pos); const char& at (size_t pos) const; #include <string>#include <iostream> using namespace std;int main(){ string s1("test"); for(    阅读全文
posted @ 2019-12-23 10:25
MoonXu
阅读(168)
评论(0)
推荐(0)
        
            
        
        
摘要:        
string (1) string& assign (const string& str); substring (2) string& assign (const string& str, size_t subpos, size_t sublen); c-string (3) string& as    阅读全文
posted @ 2019-12-23 10:14
MoonXu
阅读(498)
评论(0)
推荐(0)
        
            
        
        
摘要:        
string (1) string& append (const string& str); substring (2) string& append (const string& str, size_t subpos, size_t sublen); c-string (3) string& ap    阅读全文
posted @ 2019-12-23 09:53
MoonXu
阅读(558)
评论(0)
推荐(0)
        
 
                     
                    
                 
                    
                
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号