countGraphemes

Counts the number of grapheme clusters (character count) in a UTF string.

This function uses "extended grapheme clusters" as defined in Unicode: http://unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries

When invalid byte sequences are encountered, each byte that does not make up a code point will be counted as one grapheme as visual representations of such broken strings will often show a square with the hexadecimal byte value in them.

@nogc @trusted pure nothrow
size_t
countGraphemes
(
scope const(char)[] str
)

Parameters

str const(char)[]

the UTF-8 string

Return Value

Type: size_t

the number of grapheme clusters

Meta