decodeUTF8NoGC

@nogc version of std.utf.decode() for char[].

The caller must handle ASCII (< 0x80) characters manually; this is asserted to force code using this function to be efficient.

decodeUTF8NoGC
@trusted pure nothrow @nogc
(
Flag!"validated" validated
)
(
const(char[]) str
,
ref size_t index
)

Parameters

validated

If ture, assume str is a valid UTF-8 string and don't generate any error-checking code. If validated is true, str must be a valid character, otherwise undefined behavior will occur. Also affects the return type.

str
Type: const(char[])

Will decode the first code point from this string.

index
Type: size_t

Index in str where the code point starts. Will be updated to point to the next code point.

Return Value

Type: auto

If validated is true, the decoded character. Otherwise a struct with a 'decoded' member - the decoded character, and a 'string errorMessage' member that is null on success and otherwise stores the error message.

Meta