资源说明:
=pod =encoding UTF-8 =head1 NAME Unicode::CaseFold - Unicode case-folding for case-insensitive lookups. =head1 VERSION version 1.01 =head1 SYNOPSIS use Unicode::CaseFold; my $folded = fc $string; =head2 What is Case-Folding? In non-Unicode contexts, a common idiom to compare two strings case-insensitively is C. Before comparing two strings we I them to an all-lowercase version. C<"Hello">, C<"HELLO">, and C<"HeLlO"> all have the same lowercase form (C<"hello">), so it doesn't matter which one we start with; they are all equal to one another after C . In Unicode, things aren't so simple. A Unicode character might have mappings for I , I , and I , and the lowercase mapping of the uppercase mapping of a given character might not be the character that you started with! For example C<< lc(uc("\N{LATIN SMALL LETTER SHARP S")) >> is C<"ss">, not the eszett we started off with! Case-folding is a part of the Unicode standard that allows any two strings that differ from one another only by case to map to the same "case-folded" form, even when those strings include characters with complex case-mappings. =head2 Use for Case-insensitive Comparison Simply write C instead of C . You can also use C on case-folded strings for substring search. =head2 Use for String Lookups Frequently we want to store data in a hash, or a database, or an external file for later retrieval. Sometimes we want to be able to match the keys in this data case-insensitively -- that is, we should be able to store some data under the key "hello" and later retrieve it with the key "HELLO". Some databases have complete support for collation, but in other databases the support is missing or broken, and Perl hashes don't support it at all. By making case-folding part of the process you use to normalize your keys before using them to access a database or data structure, you get case-insensitive lookup. $roles{fc "Samuel L. Jackson"} = ["Gin Rummy", "Nick Fury", "Mace Windu"]; $roles = $roles{fc "Samuel l. JACKSON"}; # Gets the data. =head1 DESCRIPTION This module provides Unicode case-folding for Perl. Case-folding is a tool that allows a program to make case-insensitive string comparisons or do case-insensitive lookups. =head1 EXPORTS =head2 fc($str) Exported by default when you use the module. C
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。