utf8Length

Calculates the number of UTF8 code points in a UTF8-encoded string. Calls error_dg if an invalid UTF8 code unit is detected, which may throw an exception to abort processing.

  1. size_t utf8Length(cstring str)
  2. size_t utf8Length(cstring str, void delegate(size_t) error_dg)
    size_t
    utf8Length
    (,
    scope void delegate
    (
    size_t
    )
    error_dg
    )

Parameters

str cstring

The string to calculate the length of.

error_dg void delegate
(
size_t
)

The error delegate to call upon finding an invalid code unit. Takes a size_t parameter representing the index of the current code point in the string.

Return Value

Type: size_t

The length of the given string.

Meta