The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

String::Hankaku - judge that argument is hankaku-katakana or not

SYNOPSIS

package YourPackage;

use strict;
use warning;
use String::JP::Hankaku;
use Encode qw(encode_utf8);
use utf8;

my $string = qw/aあエ9波ヲ/;
for (split //, $string) {
    print encode_utf8($_), ": ";
    print is_hankaku_katakana($_);
}
  
# a: 0
# あ: 0
# エ: 1
# 9: 0
# 波: 0
# ヲ: 1

DESCRIPTION

This module is aim for checking easy that argument is hankaku-katakana or not.

Unicode block is very useful. If we want to judge Japanese hankaku-katakana, we use \p{InHalfwidthAndFullwidthForms}. But, this unicode block contain zenkaku-number and so on.

So, I make this module to easy judge hankaku-katakana.

METHODS

is_hankaku_katakana

# return 1 or 0
is_hankaku_katakana($str);

This method can judge argument is hankaku-katakana or not. Return value is 1 (hankaku-katakana) or 0 (not hankaku-katakana).

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.