Function BasicString.length

Returns the length of the string, in terms of number of characters (utf code units).

size_t length() const pure nothrow @nogc @property scope @trusted;

This is the number of actual characters that conform the contents of the BasicString, which is not necessarily equal to its storage capacity.


BasicString!char str = "123";
assert(str.length == 3);

BasicString!wchar wstr = "123";
assert(wstr.length == 3);

BasicString!dchar dstr = "123";
assert(dstr.length == 3);