Modifying Operations
C++ gives us a variety of tools to modify and manipulate strings.
Strings have many operations that can modify them. str.assign
assigns a new string to the string str
. With str.swap
we can swap two strings. To remove a character from a string use str.pop_back
or str.erase
. On the contrary, str.clear
or str.erase
deletes the whole string. To append new characters to a string, use +=, std.append
or str.push_back
. We can use str.insert
to insert new ...