Function BasicString.clear

Erases the contents of the BasicString, which becomes an empty string (with a length of 0 characters).

void clear() pure nothrow @nogc scope @trusted;

Doesn't change capacity of string.

Examples

BasicString!char str = "123";

str.reserve(str.capacity * 2);
assert(str.length == 3);

const size_t cap = str.capacity;
str.clear();
assert(str.capacity == cap);