A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.tutorialspoint.com/cpp_standard_library/cpp_string_append.htm below:

C++ String Append

C++ String Library - append Description

It extends the string by appending additional characters at the end of its current value.

Declaration

Following 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 Return Value

It returns *this.

Exceptions

if an exception is thrown, there are no changes in the string.

Example

In 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