BrowserREPL-button-tip-on BrowserREPL-button-tip-off

EditButtonTip 2023-02-28

class Collation

Encapsulates instructions about how strings should be sorted

class Collation { }
Code

Collation is the class that allows proper sorting, taking into account all Unicode characteristics. It's the class the object $*COLLATION is instantiated to, and thus includes collation levels, that is, what kind of features should be looked up when comparing two strings and in which order.

Methods§

method set§

method set (
    Int :$primary    = 1,
    Int :$secondary  = 1,
    Int :$tertiary   = 1,
    Int :$quaternary = 1)
Code

Sets if the different levels should be used in ascending or descending order, or if they are going to be ignored (when set to 0).

my $*COLLATION = Collation.new;
say 'a' coll 'z'; # OUTPUT: «Less␤»
$*COLLATION.set(:primary(-1));
say 'a' coll 'z'; # OUTPUT: «More␤»
Code

method primary§

method primary
Code

Returns the state of the primary collation level.

method secondary§

method secondary
Code

Returns the state of the secondary collation level.

method tertiary§

method tertiary
Code

Returns the state of the tertiary collation level.

method quaternary§

method quaternary
Code

Returns the state of the quaternary collation level.

Class relation diagram§

Rakudo Type Relation for Collation Collation Collation Any Any Collation->Any is