Added in API level 24

UnicodeFilter


abstract class UnicodeFilter : UnicodeMatcher
kotlin.Any
   ↳ android.icu.text.UnicodeFilter

UnicodeFilter defines a protocol for selecting a subset of the full range (U+0000 to U+FFFF) of Unicode characters. Currently, filters are used in conjunction with classes like android.icu.text.Transliterator to only process selected characters through a transformation.

Summary

Inherited constants
Public methods
abstract Boolean

Returns true for characters that are in the selected subset.

open Int
matches(text: Replaceable!, offset: IntArray!, limit: Int, incremental: Boolean)

Default implementation of UnicodeMatcher::matches() for Unicode filters.

Inherited functions

Public methods

contains

Added in API level 24
abstract fun contains(c: Int): Boolean

Returns true for characters that are in the selected subset. In other words, if a character is to be filtered, then contains() returns false.

matches

Added in API level 24
open fun matches(
    text: Replaceable!,
    offset: IntArray!,
    limit: Int,
    incremental: Boolean
): Int

Default implementation of UnicodeMatcher::matches() for Unicode filters. Matches a single 16-bit code unit at offset.

Parameters
text Replaceable!: the text to be matched
offset IntArray!: on input, the index into text at which to begin matching. On output, the limit of the matched text. The number of matched characters is the output value of offset minus the input value. Offset should always point to the HIGH SURROGATE (leading code unit) of a pair of surrogates, both on entry and upon return.
limit Int: the limit index of text to be matched. Greater than offset for a forward direction match, less than offset for a backward direction match. The last character to be considered for matching will be text.charAt(limit-1) in the forward direction or text.charAt(limit+1) in the backward direction.
incremental Boolean: if true, then assume further characters may be inserted at limit and check for partial matching. Otherwise assume the text as given is complete.
Return
Int a match degree value indicating a full match, a partial match, or a mismatch. If incremental is false then U_PARTIAL_MATCH should never be returned.