Empty string: Difference between revisions
Content added Content deleted
m (→{{header|C++}}) |
m (→{{header|C++}}) |
||
Line 463: | Line 463: | ||
str = ""; // replace contents with empty string |
str = ""; // replace contents with empty string |
||
str = {}; // swap contents with temp string (empty),then destruct temp |
str = {}; // swap contents with temp string (empty),then destruct temp |
||
⚫ | |||
// swap with empty string |
|||
std::string tmp{}; // temp empty string |
|||
str.swap(tmp); // (builtin swap function) |
|||
⚫ | |||
// create an array of empty strings |
// create an array of empty strings |