The codes routine

Combined from primary sources listed below.

In class Cool ( Type/Cool )§

See primary docmentation in context for routine codes.

routine codes§

sub codes(Str(Cool))
method codes()

Coerces the invocant (or in sub form, its argument) to Str, and returns the number of Unicode code points.

say 'møp'.codes;    # OUTPUT: «3␤»

The same result will be obtained with

say +'møp'.ords;    # OUTPUT: «3␤»

ords first obtains the actual codepoints, so there might be a difference in speed.

In class Uni ( Type/Uni )§

See primary docmentation in context for method codes.

method codes§

method codes(Uni:D: --> Int:D)

Returns the number of codepoints in the invocant.