BasicString.downsize

Downsizes the string to a length of n characters (utf code units).

If n is smaller than the current string length, the current value is shortened to its first n character, removing the characters beyond the nth.

If n is greater or equal than the current string length, the nothing happend.

struct BasicString
scope pure nothrow @safe @nogc
void
downsize
(
const size_t n
)

Examples

BasicString!char str = "123";

str.downsize(5);
assert(str == "123");

str.downsize(2);
assert(str == "12");

Meta