-
-
Save ThomasRettig/6665883df0701bcba8e06d20629897dd to your computer and use it in GitHub Desktop.
Unicode Collation Algorithm (sort)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Unicode::Collate; | |
# https://metacpan.org/pod/Unicode::Collate | |
my @unsorted = ('A', "\xF0\x9F\x97\x91", 'B'); | |
print "unsorted:\n"; | |
foreach (@unsorted) { | |
print "$_\n"; | |
} | |
my @sorted = Unicode::Collate->new()->sort(@unsorted); | |
print "-------------\n"; | |
print "sorted:\n"; | |
foreach (@sorted) { | |
print "$_\n"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unsorted: | |
A | |
🗑 | |
B | |
------------- | |
sorted: | |
A | |
B | |
🗑 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment