Unicode::ICU::Collate - ICU Unicode Collation services



NAME

Unicode::ICU::Collate - ICU Unicode Collation services


DESCRIPTION

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.


METHODS/FUNCTIONS

OO Interface

new

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.

compare

Compares two strings using the collation object's locale.

sortkey

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:

Procedural interface

icu_strcoll

 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.


BUGS AND LIMITATIONS

Many.


ACKNOWLEDGEMENTS

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/


LICENSE AND COPYRIGHT

Copyright 2008 Martin Kutter.

This library is free software. You may distribute/modify it under the same terms as perl itself


AUTHOR

Martin Kutter <martin.kutter fen-net.de>


REPOSITORY INFORMATION

 $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