클래스 Collation
클래스 Collation (Collation) (raku-type-collation)
Unicode의 모든 특성을 고려해 제대로 정렬할 수 있게 해 주는 클래스가 Collation이에요. $*COLLATION 객체가 바로 이 클래스로 만들어진 인스턴스예요. 그래서 이 객체에는 collation level(정렬 레벨)이 담기는데, 두 문자열을 비교할 때 어떤 특성을 어떤 순서로 볼지를 정해요.
class Collation { }
method set
method set (
Int :$primary = 1,
Int :$secondary = 1,
Int :$tertiary = 1,
Int :$quaternary = 1)
각 레벨을 오름차순으로 쓸지, 내림차순으로 쓸지, 아니면 무시할지(0으로 설정)를 정해요.
my $*COLLATION = Collation.new;
say 'a' coll 'z'; # OUTPUT: «Less»
$*COLLATION.set(:primary(-1));
say 'a' coll 'z'; # OUTPUT: «More»
method primary
method primary
주요 정렬 레벨(primary collation level)의 상태를 돌려줘요.
method secondary
method secondary
보조 정렬 레벨(secondary collation level)의 상태를 돌려줘요.
method tertiary
method tertiary
3차 정렬 레벨(tertiary collation level)의 상태를 돌려줘요.
method quaternary
method quaternary
4차 정렬 레벨(quaternary collation level)의 상태를 돌려줘요.