Download the PHP package sharapeco/kana-order without Composer
On this page you can find all versions of the php package sharapeco/kana-order. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download sharapeco/kana-order
More information about sharapeco/kana-order
Files in sharapeco/kana-order
Download sharapeco/kana-order
More information about sharapeco/kana-order
Files in sharapeco/kana-order
Vendor sharapeco
Package kana-order
Short Description Create string that gives Japanese dictionary order from kana.
License MIT
Package kana-order
Short Description Create string that gives Japanese dictionary order from kana.
License MIT
Please rate this library. Is it a good library?
Informations about the package kana-order
KanaOrder for PHP
KanaOrder は項目を辞書順に並べるためのライブラリです。
入出力文字列は UTF-8 でエンコードされているもののみ扱えます。
使用方法
KanaOrder::get() は「すずめ」「ひよどり」など読みがなとして入力された文字列を引数として鳥、 strcmp など文字コードで文字列を比較する関数を使って比較した際、 辞書順となる文字列を出力する関数です。
example/example1.php を実行してみてください。 次のように辞書順に並んだ結果が出力されると思います。
準拠している「辞書順」
このライブラリは Wikipedia の索引の配列に基づいて実装されています。
- 読みの五十音順とする。
- 清音・濁音・半濁音は、この順に並べる。
- 促音「っ」、拗音「ゃ」「ゅ」「ょ」はそれぞれ「つ」「や」「ゆ」「よ」の後に並べる。
- 小文字「ァ」「ィ」「ゥ」「ェ」「ォ」はそれぞれ「あ」「い」「う」「え」「お」の後に並べる。
- 長音符「ー」は直前の母音を表すものとし、それぞれ仮名の後に並べる。 例: 「コーヒー」は「こおひい」と見なす。
- ひらがなとカタカナは、この順に並べる。
Collator との違い
PHP に同梱されている intl 拡張モジュールに含まれる Collator でも同様のことが実現できますが、 「辞書順」の定義が若干異なっています。
example/example1.php の例では次のように並び順が異なります。
KanaOrder | Collator |
---|---|
かつ | カツ |
カツ | かつ |
しいく | シーク |
シーク | しいく |
ジーク | ジーク |
しいくいん | しいくいん |
ひよう | ひょう |
ひょう | ひよう |
びょう | びょう |
ぴょう | ぴょう |
ひょうい | ひょうい |
びよういん | びょういん |
びょういん | びよういん |
ひようかん | ひようかん |
ひょうきん | ひょうきん |
ひよどり | ひよどり |
All versions of kana-order with dependencies
PHP Build Version
Package Version
Requires
php Version
>=5.3.3
The package sharapeco/kana-order contains the following files
Loading the files please wait ....