Added in API level 24

CountMethod


class CountMethod
kotlin.Any
   ↳ kotlin.Enum<android.icu.text.UnicodeSetSpanner.CountMethod>
   ↳ android.icu.text.UnicodeSetSpanner.CountMethod

Options for replaceFrom and countIn to control how to treat each matched span. It is similar to whether one is replacing [abc] by x, or [abc]* by x.

Summary

Enum values

Use the smallest number of elements in the spanned range for counting and modification, based on the UnicodeSet.SpanCondition.

Collapse spans.

Enum values

MIN_ELEMENTS

Added in API level 24
enum val MIN_ELEMENTS : UnicodeSetSpanner.CountMethod

Use the smallest number of elements in the spanned range for counting and modification, based on the UnicodeSet.SpanCondition. If the set has no strings, this will be the same as the number of spanned code points.

For example, in the string "abab" with SpanCondition.SIMPLE:

  • spanning with [ab] will count four MIN_ELEMENTS.
  • spanning with [{ab}] will count two MIN_ELEMENTS.
  • spanning with [ab{ab}] will also count two MIN_ELEMENTS.

WHOLE_SPAN

Added in API level 24
enum val WHOLE_SPAN : UnicodeSetSpanner.CountMethod

Collapse spans. That is, modify/count the entire matching span as a single item, instead of separate set elements.