assumeUTF

fnauto assumeUTF(T)(T[] arr) if (staticIndexOf!(immutable T, immutable ubyte, immutable ushort, immutable uint) != - 1)

Assume the given array of integers arr is a well-formed UTF string and return it typed as a UTF string.

ubyte becomes char, ushort becomes wchar and uint becomes dchar. Type qualifiers are preserved.

When compiled with debug mode, this function performs an extra check to make sure the return value is a valid Unicode string.

Parameters

arrarray of bytes, ubytes, shorts, ushorts, ints, or uints

Returns

arr retyped as an array of chars, wchars, or dchars

Throws

In debug mode AssertError, when the result is not a well-formed UTF string.

See Also