IntlBreakIterator クラス

(PHP 5 >= 5.5.0, PHP 7, PHP 8)

はじめに

“break iterator” は、 テキスト中のどこに境界 (たとえば、単語や文章の境目) が位置するのかに関するメソッドを公開しています。 PHP の IntlBreakIterator は、 全ての break iterator の基底クラスになります。 追加の機能が利用可能な場合は、 intl 拡張モジュールは適切なサブクラスを公開しています。 たとえば、 IntlRuleBasedBreakIteratorIntlCodePointBreakIterator です。

このクラスは、 IteratorAggregate も実装しています。 IntlBreakIterator を走査すると、 テキストに存在する連続する境界を示す、 負でない整数値を返します。 これは、UTF-8 のコード単位(バイト) の数として表現され、 テキストの最初 (これは、位置 0 になります) から取得されます。 イテレータによって返されるキーは、 {0, 1, 2, …} のように、自然数の順序に並びます。

クラス概要

classIntlBreakIteratorimplementsIteratorAggregate {
publicconstintDONE;
publicconstintWORD_NONE;
publicconstintWORD_NONE_LIMIT;
publicconstintWORD_NUMBER;
publicconstintWORD_LETTER;
publicconstintWORD_KANA;
publicconstintWORD_KANA_LIMIT;
publicconstintWORD_IDEO;
publicconstintWORD_IDEO_LIMIT;
publicconstintLINE_SOFT;
publicconstintLINE_SOFT_LIMIT;
publicconstintLINE_HARD;
publicconstintLINE_HARD_LIMIT;
publicconstintSENTENCE_TERM;
publicconstintSENTENCE_SEP;
private__construct()
publiccurrent(): int
publicfirst(): int
publicfollowing(int$offset): int
publicgetErrorCode(): int
publicgetLocale(int$type): string|false
publicgetPartsIterator(string$type = IntlPartsIterator::KEY_SEQUENTIAL): IntlPartsIterator
publicgetText(): ?string
publicisBoundary(int$offset): bool
publiclast(): int
publicnext(?int$offset = null): int
publicpreceding(int$offset): int
publicprevious(): int
publicsetText(string$text): bool
}

変更履歴

バージョン説明
8.0.0IntlBreakIterator は、 IteratorAggregate を実装しました。 これより前のバージョンでは、 Traversable を代わりに実装していました。

目次

To Top