Created
January 10, 2019 20:37
-
-
Save rsms/97c7c818cd98b11d38ea75078d2b5db2 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