The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WordLists::Sort::Typical

SYNOPSIS

        'A14' cmp 'A2'; # sadly returns -1, so instead do this:
        use WordLists::Sort::Typical qw(cmp_alnum);
        cmp_alnum('A14', 'A2'); # returns 1

DESCRIPTION

This provides functions for sorting text.

cmp_alnum

Compares alphanumeric values sensibly, e.g. "Unit 10" comes after "Unit 9", not before "Unit 2". Case-insensitive.

cmp_alnum_only

Compares alphanumeric values sensibly as cmp_alnum, but ignores all values except alphanumeric characters, so "re-factor" sorts with "refactor", not between "re" and "react". Case-insensitive.

cmp_accnum

Compares alphanumeric values sensibly as cmp_alnum, and considers accented characters to be equivalent to unaccented characters, so "café" sorts with "cafe", not after "caftan".

cmp_accnum_only

Compares alphanumeric values sensibly and accent-insensitively as cmp_accnum, and ignores non-alphanumeric content like cmp_alnum_only

cmp_ver

Compares version numbers sensibly, even if they are of the form "v1.0028_01a".

cmp_dict

This uses a complex_sort, the first stage being cmp_accnum_only. Strings which are still equal are progressively sorted with tie-breakers so that order is reliable. Strings beginning "the " are sorted identically, except at the end, when strings without "the " have preference.

  • Case - uppercase comes after lowercase.

  • Accents - uppercase comes after lowercase.

  • Non-alphanumeric characters - these are sorted, ignoring other intervening characters.

  • Definite article - if the strings are otherwise identical, a string beginning "the " comes after a string not beginning "the "

BUGS

Please use the Github issues tracker.

LICENSE

Copyright 2011-2012 © Cambridge University Press. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.