The previous content is dropped.
The assign member function provides a similar functionality with additional options.
Parameters
- str
- string object. A copy of the content of this object is used as the new content for the object.
- s
- A pointer to an array containing a null-terminated character sequence (C string), which is copied as the new content for the object.
- c
- Character. The content is set to a single character.
Return Value
*thisExample
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
Output:
Test string: x |
Basic template member declarations
( basic_string<charT,traits,Allocator> )| 1 2 3 4 5 |
|
See also
| string::assign | Assign content to string (public member function) |
| string::operator+= | Append to string (public member function) |
| string::insert | Insert into string (public member function) |
| string::replace | Replace part of string (public member function) |
| string::string | Construct string object (constructor member) |
| string::compare | Compare strings (public member function) |
