public
static
final
enum
UnicodeSet.SpanCondition
extends Enum<UnicodeSet.SpanCondition>
java.lang.Object | ||
↳ | java.lang.Enum<android.icu.text.UnicodeSet.SpanCondition> | |
↳ | android.icu.text.UnicodeSet.SpanCondition |
Argument values for whether span() and similar functions continue while the current character is contained vs. not contained in the set.
The functionality is straightforward for sets with only single code points, without strings (which is the common case):
Note: Unpaired surrogates are treated like surrogate code points. Similarly, set strings match only on code point boundaries, never in the middle of a surrogate pair.
Enum values | |
---|---|
UnicodeSet.SpanCondition |
CONDITION_COUNT
One more than the last span condition. |
UnicodeSet.SpanCondition |
CONTAINED
Spans the longest substring that is a concatenation of set elements (characters or strings). |
UnicodeSet.SpanCondition |
NOT_CONTAINED
Continues a span() while there is no set element at the current position. |
UnicodeSet.SpanCondition |
SIMPLE
Continues a span() while there is a set element at the current position. |
Public methods | |
---|---|
static
UnicodeSet.SpanCondition
|
valueOf(String name)
|
static
final
SpanCondition[]
|
values()
|
Inherited methods | |
---|---|
From
class
java.lang.Enum
| |
From
class
java.lang.Object
| |
From
interface
java.lang.Comparable
|
UnicodeSet.SpanCondition CONDITION_COUNT
One more than the last span condition.
UnicodeSet.SpanCondition CONTAINED
Spans the longest substring that is a concatenation of set elements (characters or strings). (For characters only, this is like while contains(current)==true).
When span() returns, the substring between where it started and the position it returned consists only of set elements (characters or strings) that are in the set.
If a set contains strings, then the span will be the longest substring for which there
exists at least one non-overlapping concatenation of set elements (characters or strings).
This is equivalent to a POSIX regular expression for (OR of each set element)*
.
(Java/ICU/Perl regex stops at the first match of an OR.)
UnicodeSet.SpanCondition NOT_CONTAINED
Continues a span() while there is no set element at the current position. Increments by one code point at a time. Stops before the first set element (character or string). (For code points only, this is like while contains(current)==false).
When span() returns, the substring between where it started and the position it returned consists only of characters that are not in the set, and none of its strings overlap with the span.
UnicodeSet.SpanCondition SIMPLE
Continues a span() while there is a set element at the current position. Increments by the longest matching element at each position. (For characters only, this is like while contains(current)==true).
When span() returns, the substring between where it started and the position it returned consists only of set elements (characters or strings) that are in the set.
If a set only contains single characters, then this is the same as CONTAINED.
If a set contains strings, then the span will be the longest substring with a match at each position with the longest single set element (character or string).
Use this span condition together with other longest-match algorithms, such as ICU converters (ucnv_getUnicodeSet()).
UnicodeSet.SpanCondition valueOf (String name)
Parameters | |
---|---|
name |
String
|
Returns | |
---|---|
UnicodeSet.SpanCondition |