摘要:
void clear() noexcept;功能:把string对象置为空 #include <iostream>#include <string> using namespace std; int main(){ char c; string str; cout << "please enter 阅读全文
摘要:
const_iterator cbegin() const noexcept; const_iterator cend() const noexcept;注:返回常量迭代器,不能修改 #include <iostream>#include <string> using namespace std; 阅读全文
摘要:
size_t capacity() const noexcept; #include <iostream>#include <string> using namespace std; int main(){ string s1("hello"); cout << "capacity:" << s1. 阅读全文
摘要:
iterator begin() noexcept; const_iterator begin() const noexcept; iterator end() noexcept; const_iterator end() const noexcept; #include <iostream>#in 阅读全文
摘要:
char& back(); const char& back() const; #include <iostream>#include <string> using namespace std;int main(){ string s1("hello"); cout << s1.back() << 阅读全文
摘要:
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( 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文