IntlBreakIterator
class IntlBreakIterator implements IteratorAggregate (View source)
A “break iterator” is an ICU object that exposes methods for locating boundaries in text (e.g. word or sentence boundaries). The PHP IntlBreakIterator serves as the base class for all types of ICU break iterators. Where extra functionality is available, the intl extension may expose the ICU break iterator with suitable subclasses, such as IntlRuleBasedBreakIterator or IntlCodePointBreakIterator.
This class implements IteratorAggregate. Traversing an IntlBreakIterator yields non-negative integer values representing the successive locations of the text boundaries, expressed as UTF-8 code units (byte) counts, taken from the beginning of the text (which has the location 0). The keys yielded by the iterator simply form the sequence of natural numbers {0, 1, 2, …}.
Constants
| DONE |
|
| WORD_NONE |
|
| WORD_NONE_LIMIT |
|
| WORD_NUMBER |
|
| WORD_NUMBER_LIMIT |
|
| WORD_LETTER |
|
| WORD_LETTER_LIMIT |
|
| WORD_KANA |
|
| WORD_KANA_LIMIT |
|
| WORD_IDEO |
|
| WORD_IDEO_LIMIT |
|
| LINE_SOFT |
|
| LINE_SOFT_LIMIT |
|
| LINE_HARD |
|
| LINE_HARD_LIMIT |
|
| SENTENCE_TERM |
|
| SENTENCE_TERM_LIMIT |
|
| SENTENCE_SEP |
|
| SENTENCE_SEP_LIMIT |
|
Methods
(PHP 5 >=5.5.0)
Create break iterator for boundaries of combining character sequences
(PHP 5 >=5.5.0)
Create break iterator for boundaries of code points
(PHP 5 >=5.5.0)
Create break iterator for logically possible line breaks
(PHP 5 >=5.5.0)
Create break iterator for sentence breaks
(PHP 5 >=5.5.0)
Create break iterator for title-casing breaks
(PHP 5 >=5.5.0)
Create break iterator for word breaks
(PHP 5 >=5.5.0)
Get index of current position
(PHP 5 >=5.5.0)
Set position to the first character in the text
(PHP 5 >=5.5.0)
Advance the iterator to the first boundary following specified offset
(PHP 5 >=5.5.0)
Get last error code on the object
(PHP 5 >=5.5.0)
Get last error message on the object
(PHP 5 >=5.5.0)
Get the locale associated with the object
(PHP 5 >=5.5.0)
Create iterator for navigating fragments between boundaries
(PHP 5 >=5.5.0)
Get the text being scanned
(PHP 5 >=5.5.0)
Tell whether an offset is a boundary's offset
(PHP 5 >=5.5.0)
Set the iterator position to index beyond the last character
(PHP 5 >=5.5.0)
(PHP 5 >=5.5.0)
(PHP 5 >=5.5.0)
Set the iterator position to the boundary immediately before the current
(PHP 5 >=5.5.0)
Set the text being scanned
No description
Details
static IntlBreakIterator|null
createCharacterInstance(string $locale = null)
(PHP 5 >=5.5.0)
Create break iterator for boundaries of combining character sequences
static IntlCodePointBreakIterator
createCodePointInstance()
(PHP 5 >=5.5.0)
Create break iterator for boundaries of code points
static IntlBreakIterator|null
createLineInstance(string $locale = null)
(PHP 5 >=5.5.0)
Create break iterator for logically possible line breaks
static IntlBreakIterator|null
createSentenceInstance(string $locale = null)
(PHP 5 >=5.5.0)
Create break iterator for sentence breaks
static IntlBreakIterator|null
createTitleInstance(string $locale = null)
(PHP 5 >=5.5.0)
Create break iterator for title-casing breaks
static IntlBreakIterator|null
createWordInstance(string $locale = null)
(PHP 5 >=5.5.0)
Create break iterator for word breaks
int
current()
(PHP 5 >=5.5.0)
Get index of current position
int
first()
(PHP 5 >=5.5.0)
Set position to the first character in the text
int
following(int $offset)
(PHP 5 >=5.5.0)
Advance the iterator to the first boundary following specified offset
int
getErrorCode()
(PHP 5 >=5.5.0)
Get last error code on the object
string
getErrorMessage()
(PHP 5 >=5.5.0)
Get last error message on the object
string|false
getLocale(int $type)
(PHP 5 >=5.5.0)
Get the locale associated with the object
IntlPartsIterator
getPartsIterator(int|string $type = IntlPartsIterator::KEY_SEQUENTIAL)
(PHP 5 >=5.5.0)
Create iterator for navigating fragments between boundaries
string|null
getText()
(PHP 5 >=5.5.0)
Get the text being scanned
bool
isBoundary(int $offset)
(PHP 5 >=5.5.0)
Tell whether an offset is a boundary's offset
int
last()
(PHP 5 >=5.5.0)
Set the iterator position to index beyond the last character
int
next(int $offset = null)
(PHP 5 >=5.5.0)
int
preceding(int $offset)
(PHP 5 >=5.5.0)
int
previous()
(PHP 5 >=5.5.0)
Set the iterator position to the boundary immediately before the current
setText(string $text)
(PHP 5 >=5.5.0)
Set the text being scanned
Traversable
getIterator()
No description