摘要:        
char& front(); const char& front() const;功能:返回string对象的首个字符,可以改变它的值 #include <string>#include <iostream> using namespace std; int main(){ string s1("t    阅读全文
posted @ 2019-12-24 23:33
MoonXu
阅读(366)
评论(0)
推荐(0)
        
            
        
        
摘要:        
string (1) size_t find_last_of (const string& str, size_t pos = npos) const noexcept; c-string (2) size_t find_last_of (const char* s, size_t pos = np    阅读全文
posted @ 2019-12-24 14:07
MoonXu
阅读(595)
评论(0)
推荐(0)
        
            
        
        
摘要:        
#include <iostream>#include <string> using namespace std;int main(){ string s1("abcdemyyngl"); string s2("mngf"); size_t n = s1.find_last_not_of(s2);     阅读全文
posted @ 2019-12-24 12:19
MoonXu
阅读(697)
评论(0)
推荐(0)
        
            
        
        
摘要:        
string (1) size_t find_first_of (const string& str, size_t pos = 0) const noexcept; c-string (2) size_t find_first_of (const char* s, size_t pos = 0)     阅读全文
posted @ 2019-12-24 11:49
MoonXu
阅读(589)
评论(0)
推荐(0)
        
            
        
        
摘要:        
string (1) size_t find_first_not_of (const string& str, size_t pos = 0) const noexcept; c-string (2) size_t find_first_not_of (const char* s, size_t p    阅读全文
posted @ 2019-12-24 10:41
MoonXu
阅读(581)
评论(0)
推荐(0)
        
            
        
        
摘要:        
sequence (1) string& erase (size_t pos = 0, size_t len = npos);两个参数都有默认值,传递的唯一参数匹配第一个 character (2) iterator erase (const_iterator p);//擦除迭代器指定的一个字符 r    阅读全文
posted @ 2019-12-24 09:37
MoonXu
阅读(249)
评论(0)
推荐(0)
        
            
        
        
摘要:        
bool empty() const noexcept;注:判断string对象是否为空,为空返回true #include <iostream>#include <string> using namespace std; int main(){ string line; string conten    阅读全文
posted @ 2019-12-24 09:07
MoonXu
阅读(254)
评论(0)
推荐(0)
        
            
        
        
摘要:        
const char* data() const noexcept;注:同c_str #include <iostream>#include <string>#include <cstring>using namespace std;int main(){ string s1("hellolyy")    阅读全文
posted @ 2019-12-24 08:59
MoonXu
阅读(213)
评论(0)
推荐(0)
        
 
                     
                    
                 
                    
                
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号