Unicode::ICU::Collate - ICU Unicode Collation services |
Unicode::ICU::Collate - ICU Unicode Collation services
This library wraps (part of) ICU's Unicode Collation Services for perl.
ICU is a mature C, C++ and Java library providing Unicode and Globalization support. ICU is also used by parrot.
Collation is the sort rules - for example, the letter รค
is sorted between
a
and b
in German, but as a extra letter after z
in Swedish.
Constructor.
Returns a collation object. Requires the locale as only parameter.
Note that the locale is a ICU locale, not your system's or perl's (or a POSIX) locale. See http://www.icu-project.org/userguide/locale.html if in question.
Compares two strings using the collation object's locale.
Obtain a sort key for a string. If you need to compare large numbers of records repeatedly, it might be more efficient to obtain a sortkey for every element and sort the sortkeys instead.
Note, however, that this is almost certainly slower for one-time searches:
my $strcmp = Unicode::ICU::Collate::icu_strcoll($locale, $a, $b);
Compares two strings using the locale given. The locale is a ICU locale string.
Note that this function is a magnitude slower than the OO interface - it's only here for convenience and testing.
Many.
This library was largely inspired by Unicode::Transliterate by Jean-Michel Hiver, which also uses ICU.
The ICU library does the actual work: See http://www.icu-project.org/
Copyright 2008 Martin Kutter.
This library is free software. You may distribute/modify it under the same terms as perl itself
Martin Kutter <martin.kutter fen-net.de>
$Rev: 480 $ $LastChangedBy: kutterma $ $Id: Collate.pm 480 2008-06-01 21:24:36Z kutterma $ $HeadURL: http://svn.hyper-framework.org/Hyper/Unicode-ICU/trunk/lib/Unicode/ICU/Collate.pm $
Unicode::ICU::Collate - ICU Unicode Collation services |