Re: detecting katakana vs hiragana
| From: | Moriyoshi Koizumi | Date: | Fri, 28 Feb 2003 13:34:37 +0000 |
| Subject: | Re: detecting katakana vs hiragana | ||
| References: | 1 2 | Groups: | php.i18n |
| Request: | Send a blank email to php-i18n+get-471@lists.php.net to get a copy of this message | ||
On Fri, 28 Feb 2003 12:28:18 +0100
"Simon Dedeyne" <Simon.Dedeyne@psy.kuleuven.ac.be> wrote:
>
> Hi,
>
> Is there a way/function for detecting if a word is in katakana or
> hiragana?
> I'm using UTF-8 encoding.
>
> I don't know if it's of any help, but I wonder if a solution could be
> find through a regular expression option, like indicated (though not
> explained) here http://regex.info/indexlist.html
>
> Tnx,
> Simon
You can accomplish it by converting any hiragana / katakana mixture to either
hiragana or katakana characters with mb_convert_kana() and then comparing
it with the original.
Also try mb_ereg_* functions that allows localised characters to be used in
character classes.
Moriyoshi