Perl Unicode Cookbook: Case- and Accent-insensitive Locale Comparisons

℞ 40: Case- and accent-insensitive locale comparisons

You now know how to compare Unicode strings while ignoring case and accent differences. This approach uses the standard Unicode collation algorithm. To perform a similar comparison while respecting a specific locale’s rules, use Unicode::Collate::Locale:

 my $de = Unicode::Collate::Locale->new(
            locale => "de__phonebook",
          );

 # now this is true:
 $de->eq("tschüß", "TSCHUESS");  # notice ü => UE, ß => SS

Previous: ℞ 39: Case- and Accent-insensitive Comparison

Series Index: The Standard Preamble

Next: ℞ 41: Unicode Linebreaking

Tags

Feedback

Something wrong with this article? Help us out by opening an issue or pull request on GitHub

TPRF Gold Sponsor
TPRF Silver Sponsor
TPRF Bronze Sponsor
TPRF Bronze Sponsor