The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Linqua::JA::Halfwidth - judge given single character is japanese halfwidth or not

SYNOPSIS

  package YourPackage;
  
  use strict;
  use warning;
  use Linqua::JA::Halfwidth;
  use Encode qw(encode_utf8);
  use utf8;
  
  my $string = qw/aあエ9波ヲ/;
  for (split //, $string) {
      print encode_utf8($_), ": ";
      print is_japanese_halfwidth($_);
  }
    
  # a: 0
  # あ: 0
  # エ: 1
  # 9: 0
  # 波: 0
  # ヲ: 1

DESCRIPTION

This module is aim for checking easy that given single character is japanese halfwidth or not.

Target character is japanese halfwidth katakana and punctuation and voice marks and bracket. (See also t/01.is_japanese_halfwidth.t)

Unicode block is very useful. So, when judge Japanese halfwidth katakana and character used japanese halfwidth, we want to use \p{InHalfwidthAndFullwidthForms}. But, this unicode block contain fullwidth number and so on...

Therefore, I make this module. :-)

METHODS

is_japanese_halfwidth

  is_japanese_halfwidth($str);

This method can judge given single character is japanese halfwidth or not. Return value is 1 (japanese halfwidth) or 0 (not japanese halfwidth).

AUTHOR

sasata299 <sasata299@livedoor.com>

http://blog.livedoor.jp/sasata299/

LICENCE AND COPYRIGHT

Copyright (c) 2009, sasata299 <sasata299@livedoor.com>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.