Function BasicString.downsize

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

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

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.

Examples

BasicString!char str = "123";

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

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