lightbulb_outline Please take our October 2018 developer survey. Start survey

UnicodeFilter

public abstract class UnicodeFilter
extends Object implements UnicodeMatcher

java.lang.Object
   ↳ android.icu.text.UnicodeFilter


UnicodeFilter defines a protocol for selecting a subset of the full range (U+0000 to U+FFFF) of Unicode characters.

Summary

Inherited constants

Public methods

abstract boolean contains(int c)

Returns true for characters that are in the selected subset.

int matches(Replaceable text, int[] offset, int limit, boolean incremental)

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

Inherited methods

Public methods

contains

added in API level 24
public abstract boolean contains (int c)

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

Parameters
c int

Returns
boolean

matches

added in API level 24
public int matches (Replaceable text, 
                int[] offset, 
                int limit, 
                boolean incremental)

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 int: 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.

Returns
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.