Class BreakIterator
The
BreakIterator
class implements methods for finding
the location of boundaries in text. Instances of BreakIterator
maintain a current position and scan over text
returning the index of characters where boundaries occur.
Inheritance
Assembly: Lucene.Net.ICU.dll
Syntax
public abstract class BreakIterator : object
Constructors
Name | Description |
---|---|
BreakIterator() | Constructor. BreakIterator is stateless and has no default behavior. |
Fields
Name | Description |
---|---|
DONE | DONE is returned by Previous(), Next(), Next(int), Preceding(int) and Following(int) when either the first or last text boundary has been reached. |
Properties
Name | Description |
---|---|
Current | Returns character index of the text boundary that was most recently returned by Next(), Next(int), Previous(), First(), Last(), Following(int) or Preceding(int). If any of these methods returns DONE because either first or last text boundary has been reached, it returns the first or last text boundary depending on which one is reached. |
Text | Get the text being scanned |
Methods
Name | Description |
---|---|
Clone() | Create a copy of this iterator |
First() | Returns the first boundary. The iterator's current position is set to the first text boundary. |
Following(Int32) | Returns the first boundary following the specified character offset. If the specified offset equals to the last text boundary, it returns DONE and the iterator's current position is unchanged. Otherwise, the iterator's current position is set to the returned boundary. The value returned is always greater than the offset or the value DONE. |
IsBoundary(Int32) | Returns true if the specified character offset is a text boundary. |
Last() | Returns the last boundary. The iterator's current position is set to the last text boundary. |
Next() | Returns the boundary following the current boundary. If the current boundary
is the last text boundary, it returns |
Next(Int32) | Returns the nth boundary from the current boundary. If either the first or last text boundary has been reached, it returns DONE and the current position is set to either the first or last text boundary depending on which one is reached. Otherwise, the iterator's current position is set to the new boundary. For example, if the iterator's current position is the mth text boundary and three more boundaries exist from the current boundary to the last text boundary, the Next(2) call will return m + 2. The new text position is set to the (m + 2)th text boundary. A Next(4) call would return DONE and the last text boundary would become the new text position. |
Preceding(Int32) | Returns the last boundary preceding the specified character offset. If the specified offset equals to the first text boundary, it returns DONE and the iterator's current position is unchanged. Otherwise, the iterator's current position is set to the returned boundary. The value returned is always less than the offset or the value DONE. |
Previous() | Returns the boundary preceding the current boundary. If the current boundary is the first text boundary, it returns and
the iterator's current position is unchanged. Otherwise, the iterator's
current position is set to the boundary preceding the current boundary.
|
SetText(CharacterIterator) | Set a new text string to be scanned. The current scan position is reset to First(). |
SetText(String) | Set a new text string to be scanned. The current scan position is reset to First(). |