691
C++ String operator+=()
This function is used to extend the string by appending new characters at the end of the string.
Syntax
Consider two strings str1 and str2. Syntax would be :
Parameter
str2: str2 is a string object which is to be appended.
s: s is a pointer to the null terminated sequence of characters.
ch: ch is a character which is to be appended to the current value of the string.
Return value
It returns *this.
Example 1
Let’s see a simple example.
Output:
java programming
Example 2
Let’s see another simple example.
Output:
1234
Example 3
Let’s see a simple example by passing single character value.
Output:
C++
Example 4
Let’s see this example.
Output:
TutorAspire Tutorial
Next TopicC++ Strings