That did it! :) At least it ignores the apostrophe, and set it to ignore
accents (I don't think we have any names with them, but you never know.when
that might happen.)
I'm still familiarizing myself with the parameters, but this code seems to
be pretty much what I want.
my $coll = Unicode::Collate->new(locale => 'en_US', normalization => undef,
level => 1);
Looping over the rows of data:
$row->{SortKey1} = $coll->getSortKey($row->{LastName});
$row->{SortKey2} = $coll->getSortKey($row->{FirstName});
$row->{SortKey3} = $coll->getSortKey($row->{MiddleNames});
Paul
On Fri, Aug 22, 2014 at 7:01 PM, Brian Pitts <[email protected]> wrote:
> You may want Unicode::Collate:Locale
>
> http://search.cpan.org/~sadahiro/Unicode-Collate-1.07/Collate/Locale.pm
>
> http://www.perl.com/pub/2012/06/perlunicook-unicode-locale-collation.html
>
>
> On 08/22/2014 06:34 PM, Paul Boniol wrote:
>
> I know there must be some Perl module out there I'm overlooking. I need to
> sort data by name. According to the Chicgo Manual of Style / US Phone
> book, you don't do just a normal sort.
>
> E.g. O'Reilly is treated as OReilly (case insensitive).
>
> (Some variations say last names starting with Mc should be treated as
> Mac. And St. Andrew should be Saint Andrew. Etc. I'm not as worried
> about those.)
>
> I've found all sorts of things for sorting in different languages,
> German phone book (umlats treated as letter and appending e). But there
> wasn't a US phone book module.
>
> I know there must be some common method / module for sorting names. My
> Google foo just can't seem to find it.
>
> I've usually just been doing a plain sort of uppercased name. This is
> okay, no one has complained. But I thought there must be a more proper way.
>
> Paul
>
>
> --
> All the best,
> Brian Pitts
>
>
--
--
You received this message because you are subscribed to the Google Groups
"NLUG" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nlug-talk?hl=en
---
You received this message because you are subscribed to the Google Groups
"NLUG" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.