Lingua::Han::UtilsThe utility tools of Chinese character (HanZi) | |
Download |
Lingua::Han::Utils Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Fayland Lam
- Publisher web site:
- http://search.cpan.org/~fayland/
Lingua::Han::Utils Tags
Lingua::Han::Utils Description
Lingua::Han::Utils is a Perl module that provides utility tools of Chinese character (HanZi).SYNOPSIS use Lingua::Han::Utils qw/Unihan_value csplit cdecode csubstr clength/; # cdecode # the same as decode('cp936', $word) in ASCII editing mode # and decode('utf8', $word) in Unicode editing mode my $word = cdecode($word); # Unihan_value # return the first field of Unihan.txt on unicode.org my $word = "我"; my $unihan = Unihan_value($word); # return '6211' my $words = "爱你"; my @unihan = Unihan_value($word); # return (7231, 4F60) my $unihan = Unihan_value($word); # return 72314F60 # csplit # split the Chinese characters into an array my $words = "我爱你"; my @words = csplit($words); # return ("我", "爱", "你") # csubstr # treat the Chinese characters as one # so it's the same as splice(csplit($words), $offset, $length) my $words = "我爱你啊"; my @words = csubstr($words, 1, 2); # return ("爱", "你") my @words = csubstr($words, 1); # return ("爱", "你", "啊") my $words = csubstr($words, 1, 2); # 爱你 # clength # treat the Chinese character as one my $words = "我爱你"; print clength($words); # 3Product's homepage
Lingua::Han::Utils Related Software