c++ string字串拼接
阿新 • • 發佈:2022-05-08
主要用於在已有字串之後追加
函式原型:
string& operator+=(const char* str); //過載+=操作符
string& operator+=(const char c); //過載+=操作符
string& operator+=(const string& str); //過載+=操作符
string& append(const char *s); //把字串s連線到當前字串結尾
string& append(const char *s, int n); //把字串s的前n個字元連線到當前字串結尾
string& append(const string &s); //同operator+=(const string& str)
string& append(const string &s, int pos, int n); //字串s中從pos開始的n個字元連線到字串結尾
hello world
hello worlds
hello worlds wanvei
hello worlds wanvei is
hello worlds wanvei iskkkk
hello worlds wanvei iskkkk wanvei
hello worlds wanvei iskkkk wanveivei