Function BasicString.upsize

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

void upsize (
  const size_t n,
  const BasicString.CharType ch = '_'
) scope;

If n is smaller or equal than the current string length, the current value doesn't change.

If n is greater than the current string length, the current content is extended by inserting at the end as many characters as needed to reach a size of n.

If ch is specified, the new elements are initialized as copies of ch, otherwise, they are _.

Examples

BasicString!char str = "123";

str.upsize(5, 'x');
assert(str == "123xx");

str.upsize(2);
assert(str == "123xx");