(PHP 5 >= 5.5.0, PHP 7)
“break迭代器”是一个ICU对象,它公开了在文本中定位边界(例如单词或句子边界)的方法。PHP IntlBreakIterator充当所有类型ICU中断迭代器的基类。如果有额外的功能可用,则intl扩展可以使用适当的子类(如IntlRuleBasedBreakIterator或IntlCodePointBreakIterator)公开ICU中断迭代器。
这个类实现可遍历。遍历IntlBreakIterator将生成表示文本边界连续位置的非负整数值,表示为从文本开头(位置为0)开始的UTF-8代码单位(字节)计数。迭代器产生的键只是自然数序列{0,1,2,…}。
IntlBreakIterator implements Traversable { /* 常量 */ const integer DONE = -1 ; const integer WORD_NONE = 0 ; const integer WORD_NONE_LIMIT = 100 ; const integer WORD_NUMBER = 100 ; const integer WORD_NUMBER_LIMIT = 200 ; const integer WORD_LETTER = 200 ; const integer WORD_LETTER_LIMIT = 300 ; const integer WORD_KANA = 300 ; const integer WORD_KANA_LIMIT = 400 ; const integer WORD_IDEO = 400 ; const integer WORD_IDEO_LIMIT = 500 ; const integer LINE_SOFT = 0 ; const integer LINE_SOFT_LIMIT = 100 ; const integer LINE_HARD = 100 ; const integer LINE_HARD_LIMIT = 200 ; const integer SENTENCE_TERM = 0 ; const integer SENTENCE_TERM_LIMIT = 100 ; const integer SENTENCE_SEP = 100 ; const integer SENTENCE_SEP_LIMIT = 200 ; /* 方法 */ private __construct ( void ) public static createCharacterInstance ([ string $locale ] ) : IntlBreakIterator public static createCodePointInstance ( void ) : IntlBreakIterator public static createLineInstance ([ string $locale ] ) : IntlBreakIterator public static createSentenceInstance ([ string $locale ] ) : IntlBreakIterator public static createTitleInstance ([ string $locale ] ) : IntlBreakIterator public static createWordInstance ([ string $locale ] ) : IntlBreakIterator public current ( void ) : int public first ( void ) : int public following ( int $offset ) : int public getErrorCode ( void ) : int intl_get_error_code ( void ) : int public getErrorMessage ( void ) : string intl_get_error_message ( void ) : string public getLocale ( string $locale_type ) : string public getPartsIterator ([ int $key_type = IntlPartsIterator::KEY_SEQUENTIAL ] ) : IntlPartsIterator public getText ( void ) : string public isBoundary ( int $offset ) : bool public last ( void ) : int public next ([ int $offset ] ) : int public preceding ( int $offset ) : int public previous ( void ) : int public setText ( string $text ) : bool }