minLength

Returns minimum/maximum possible length of string conversion to another Unicode Transformation Format result.

  1. size_t minLength(size_t length)
  2. size_t minLength(From[] str)
    @safe pure nothrow @nogc
    size_t
    minLength
    (
    To
    From
    )
    (
    in From[] str
    )
  3. size_t maxLength(size_t length)
  4. size_t maxLength(From[] str)

Examples

t
{
	import std.range;
	import std.utf;

	const str = "abc-ЭЮЯ";
	const wlen = toUTF16(str).length;
	const dlen = walkLength(str);
	assert(wlen >= minLength!wchar(str) && wlen <= maxLength!wchar(str));
	assert(dlen >= minLength!dchar(str) && dlen <= maxLength!dchar(str)

Meta