TextIterator
class TextIterator implements Iterator (View source)
A UTF8-aware TextIterator
Constants
CODE_POINT |
|
COMB_SEQUENCE |
|
CHARACTER |
|
WORD |
|
LINE |
|
SENTENCE |
|
DONE |
|
WORD_NONE |
|
WORD_NONE_LIMIT |
|
WORD_NUMBER |
|
WORD_NUMBER_LIMIT |
|
WORD_LETTER |
|
WORD_LETTER_LIMIT |
|
WORD_KANA |
|
WORD_KANA_LIMIT |
|
LINE_SOFT |
|
LINE_SOFT_LIMIT |
|
LINE_HARD |
|
LINE_HARD_LIMIT |
|
SENTENCE_TERM |
|
SENTENCE_TERM_LIMIT |
|
SENTENCE_SEP |
|
SENTENCE_SEP_LIMIT |
|
REGEXP_SENTENCE_DELIMITERS |
|
Properties
protected int | $iteratorType | ||
protected string | $subject | ||
protected int | $currentPosition | ||
protected ArrayObject | $iteratorCache | ||
protected ArrayIterator | $iteratorCacheIterator | ||
protected TextIteratorElement | $previousElement |
Methods
Constructs the TextIterator
Returns the current element
Advances the iterator to the next element
Returns the key of the current element. That means the number of the current element starting with 0.
Returns true, if the current element is not the end of the iterator
Sets the iterator back to the first element
Returns the offset in the original given string of the current element
Returns the previous element
Returns the last element of the iterator
Returns the next elment following the character of the original string given by its offset
Returns the element preceding the character of the original string given by its offset
Returns true if the current element is a boundary element.
Returns all elements of the iterator in an array
No description
No description
No description
Returns the first element
Details
__construct(string $subject, int $iteratorType = self::CHARACTER)
Constructs the TextIterator
string
current()
Returns the current element
void
next()
Advances the iterator to the next element
mixed
key()
Returns the key of the current element. That means the number of the current element starting with 0.
bool
valid()
Returns true, if the current element is not the end of the iterator
void
rewind()
Sets the iterator back to the first element
int
offset()
Returns the offset in the original given string of the current element
string
previous()
Returns the previous element
string
last()
Returns the last element of the iterator
string
following(int $offset)
Returns the next elment following the character of the original string given by its offset
string
preceding(int $offset)
Returns the element preceding the character of the original string given by its offset
bool
isBoundary()
Returns true if the current element is a boundary element.
Boundaries are:
CHARACTER: none
WORD:
array
getAll()
Returns all elements of the iterator in an array
getRuleStatus()
No description
getRuleStatusArray()
No description
getAvailableLocales()
No description
string
first()
Returns the first element