Documentation for routine chars

Documentation for routine chars, assembled from the following types:

class Cool

From Cool

(Cool) routine chars

Defined as:

sub chars(Str(Cool))
method chars()

Coerces the invocant (or in sub form, its argument) to Str, and returns the number of characters in the string. Please note that on the JVM, you currently get codepoints instead of graphemes.

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

class Str

From Str

(Str) routine chars

multi sub    chars(Cool  $x --> Int:D)
multi sub    chars(Str:D $x --> Int:D)
multi sub    chars(str   $x --> int)
multi method chars(Str:D:   --> Int:D)

Returns the number of characters in the string in graphemes. On the JVM, this currently erroneously returns the number of codepoints instead.