codeLength

Returns the number of code units that are required to encode the code point c when C is the character type used to encode it.

  1. ubyte codeLength(dchar c)
    @safe pure nothrow @nogc
    ubyte
    codeLength
    (
    C
    )
    (
    dchar c
    )
  2. size_t codeLength(InputRange input)

Examples

assert(codeLength!char('a') == 1);
assert(codeLength!wchar('a') == 1);
assert(codeLength!dchar('a') == 1);

assert(codeLength!char('\U0010FFFF') == 4);
assert(codeLength!wchar('\U0010FFFF') == 2);
assert(codeLength!dchar('\U0010FFFF') == 1);

Meta