SearchCursor

class SearchCursor(text: Text, query: String, from: DocPos = DocPos.ZERO, to: DocPos = text.endPos, normalize: (String) -> String = { it }) : Iterator<SearchMatch>

A cursor that iterates over string matches in a Text document.

Parameters

text

The document text to search through.

query

The string to search for.

from

Start position of the search range (inclusive).

to

End position of the search range (exclusive, defaults to document length).

normalize

Optional normalization function (e.g. String.lowercase for case-insensitive).

Constructors

Link copied to clipboard
constructor(text: Text, query: String, from: DocPos = DocPos.ZERO, to: DocPos = text.endPos, normalize: (String) -> String = { it })

Properties

Link copied to clipboard

Whether the cursor has been exhausted.

Link copied to clipboard

The current match, or null if iteration hasn't started or is done.

Functions

Link copied to clipboard
open operator override fun hasNext(): Boolean
Link copied to clipboard
open operator override fun next(): SearchMatch
Link copied to clipboard

Return the next match, or null if there are no more matches.