Daniel Perrett > WordLists > WordLists::Sort::Typical

Download:
WordLists-0.013.tar.gz

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Source  

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.

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.

syntax highlighting: