Perl Unicode Cookbook: Get Character Number by Name

℞ 7: Get character number by name

Unicode allows you to refer to characters by number or by name. Computers don't care, but humans do. When you have a character name, you can translate it to its number with the charnames pragma:

 use charnames ();
my $number = charnames::vianame("GREEK CAPITAL LETTER SIGMA");

This is, of course, the opposite of Get Character Names by Number.

See Characters and Their Numbers to translate from this number to the appropriate character.

Previous: ℞ 6: Get Character Names by Number

Series Index: The Standard Preamble

Next: ℞ 8: Unicode Named Characters

Visit the home of the Perl programming language:

Sponsored by

Monthly Archives

Powered by Movable Type 5.13-en