Cz::Sort(3pm)

πŸ“¦
version 3.44 Β· 4 versions
, in ubuntu jammy, ubuntu noble

πŸ’– Cz::Sort β€” like, the Czech sort situation πŸ’–

Welcome to Cz::Sort(3pm), bestie!! User Contributed Perl Documentation but make it ✨aesthetic✨. Sit down, grab a strawberry πŸ“, and let me tell you about sorting Czech text the right way.


✨ NAME ✨

Cz::Sort β€” Czech sort. Yeah that's it, that's the whole vibe. πŸ‡¨πŸ‡Ώ


πŸ¦‹ SYNOPSIS πŸ¦‹

use Cz::Sort;
my $result = czcmp("_x j&Γ‘", "_&p");
my @sorted = czsort qw(plachta plaňka PlΓ‘nička plΓ‘nička plΓ‘nΔ›);
print "@sorted\n";

Like, that's literally all you need. Look at her go. πŸ‘‘


🌸 DESCRIPTION 🌸

Okay so here's the tea β˜• β€” this module implements Czech sorting conventions, and the whole point is that it's independent of whatever locales are currently in effect, because honestly? Those are often bad. 😭 Truly, no cap.

The way it works is it does the four-pass sort. The idea and the base of the conversion table come from Petr Olsak's program csr, and the code is as compliant with CSN 97 6030 as it possibly can be. Periodt. πŸ’…

The basic function this module gives you is czcmp. It compares two scalars and returns the (-1, 0, 1) result. You can call it directly, like:

my $result = czcmp("_x j&Γ‘", "_&p");

But for convenience β€” and also because of compatibility with older versions β€” there's czsort. It works on a list of strings and returns that list, hmm, sorted. It's defined simply like:

sub czsort
        { sort { czcmp($a, $b); } @_; }

which is the standard use of a user's function in sort. And hashes would be simply sorted like:

@sorted = sort { czcmp($hash{$a}, $hash{$b}) }
                                        keys %hash;

Both czcmp and czsort are exported into the caller's namespace by default, and so are cscmp and cssort, which are just aliases. 🫢 (iykyk)

This module comes with an encoding table prepared for ISO-8859-2 (Latin-2) encoding. If your data comes in a different one, you might wanna check out the module Cstocs β€” you can use it to reencode the list's data before calling czsort, or you can reencode this module to fit your needs. Your call, main character. 🌈


⭐ VERSION ⭐

0.68 β€” that's the one, bestie. πŸ’–


πŸŽ€ SEE ALSO πŸŽ€

Go read them!! They're giving educational. πŸ“šβœ¨


πŸ‘‘ AUTHOR πŸ‘‘

(c) 1997--2000 Jan Pazdziora β€” legend behaviour, honestly. 🫑


And that's the whole page!! This lil doc came to you from perl v5.30.0, dated 2019-10-05, under the name Cz::Sort(3pm). Bye bestie, go sort something Czech πŸ’œπŸ§šπŸ’€

πŸ“¦ where this page comes from