Count characters of a string in Perl 6

Code points

The codes method is available for strings (Str objects).

$count = $str.codes;

Grapheme clusters

The chars method is available for strings (Str objects).

$count = $str.chars;