It extends the string by appending additional characters at the end of its current value.
DeclarationFollowing is the declaration for std::string::append.
string& append (const string& str);C++11
string& append (const string& str);C++14
string& append (const string& str);Parameters
str − It is a string object.
c − It is a character object.
It returns *this.
Exceptionsif an exception is thrown, there are no changes in the string.
ExampleIn below example for std::string::append.
#include <iostream> #include <string> int main () { std::string str; std::string str2="Writing "; std::string str3="print 10 and then 5 more"; str.append(str2); str.append(str3,6,3); str.append("dots are cool",5); str.append("here: "); str.append(10u,'.'); str.append(str3.begin()+8,str3.end()); str.append<int>(5,0x2E); std::cout << str << '\n'; return 0; }
Writing 10 dots here: .......... and then 5 more.....
string.htm
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4