![]() |
VOOZH | about |
The string::append() in C++ is used append the characters or the string at the end of the string. It is the member function of std::string class .
The string::append() function can be used to do the following append operations:
Table of Content
The string::append() method can be used to append the whole string at the end of the given string. We just need to pass the string to be appended as the parameter to string::append () function.
str1.append(str2);
Parameter
Return value
Hello World! GeeksforGeeks
The string::append() method can also be used to append the substring starting from the particular position till the given number of characters.
str1.append(str2, pos, num);
Parameter
Return value
Hello World! Geeks
The string::append() method is used to append the multiple characters at the end of the string.
str.append(num, c);
Parameter
Return value
Hello Geeks!!!!!
The string::append() method can also be used to append the characters from the given range at the end of the string.
str.append(first, last);
Parameter
Return value
Hello World! forGeeks