Note
method freeze() will not only make the set immutable, but also makes important methods much higher performance: contains(c), containsNone(...), span(...), spanBack(...) etc. After the object is frozen, any subsequent call that wants to change the object will throw UnsupportedOperationException.
The UnicodeSet class is not designed to be subclassed.
UnicodeSet supports two APIs. The first is the
operand API that allows the caller to modify the value of
a UnicodeSet object. It conforms to Java 2's
java.util.Set interface, although
UnicodeSet does not actually implement that
interface. All methods of Set are supported, with the
modification that they take a character range or single character
instead of an Object, and they take a
UnicodeSet instead of a Collection. The
operand API may be thought of in terms of boolean logic: a boolean
OR is implemented by add, a boolean AND is implemented
by retain, a boolean XOR is implemented by
complement taking an argument, and a boolean NOT is
implemented by complement with no argument. In terms
of traditional set theory function names, add is a
union, retain is an intersection, remove
is an asymmetric difference, and complement with no
argument is a set complement with respect to the superset range
MIN_VALUE-MAX_VALUE
The second API is the
applyPattern()/toPattern() API from the
java.text.Format-derived classes. Unlike the
methods that add characters, add categories, and control the logic
of the set, the method applyPattern() sets all
attributes of a UnicodeSet at once, based on a
string pattern.
Pattern syntax
Patterns are accepted by the constructors and theapplyPattern() methods and returned by the
toPattern() method. These patterns follow a syntax
similar to that employed by version 8 regular expression character
classes. Here are some simple examples:
Any character may be preceded by a backslash in order to remove any special meaning. White space characters, as defined by the Unicode Pattern_White_Space property, are ignored, unless they are escaped.
[]No characters [a]The character 'a' [ae]The characters 'a' and 'e' [a-e]The characters 'a' through 'e' inclusive, in Unicode code point order [\\u4E01]The character U+4E01 [a{ab}{ac}]The character 'a' and the multicharacter strings "ab" and "ac" [\p{Lu}]All characters in the general category Uppercase Letter
Property patterns specify a set of characters having a certain property as defined by the Unicode standard. Both the POSIX-like "[:Lu:]" and the Perl-like syntax "\p{Lu}" are recognized. For a complete list of supported property patterns, see the User's Guide for UnicodeSet at https://unicode-org.github.io/icu/userguide/strings/unicodeset. Actual determination of property data is defined by the underlying Unicode database as implemented by UCharacter.
Patterns specify individual characters, ranges of characters, and Unicode property sets. When elements are concatenated, they specify their union. To complement a set, place a '^' immediately after the opening '['. Property patterns are inverted by modifying their delimiters; "[:^foo]" and "\P{foo}". In any other location, '^' has no special meaning.
Since ICU 70, "[^...]", "[:^foo]", "\P{foo}", and "[:binaryProperty=No:]"
perform a “code point complement” (all code points minus the original set),
removing all multicharacter strings,
equivalent to .complement().removeAllStrings() .
The complement() API function continues to perform a
symmetric difference with all code points and thus retains all multicharacter strings.
Ranges are indicated by placing two a '-' between two characters, as in "a-z". This specifies the range of all characters from the left to the right, in Unicode order. If the left character is greater than or equal to the right character it is a syntax error. If a '-' occurs as the first character after the opening '[' or '[^', or if it occurs as the last character before the closing ']', then it is taken as a literal. Thus "[a\\-b]", "[-ab]", and "[ab-]" all indicate the same set of three characters, 'a', 'b', and '-'.
Sets may be intersected using the '&' operator or the asymmetric set difference may be taken using the '-' operator, for example, "[[:L:]&[\\u0000-\\u0FFF]]" indicates the set of all Unicode letters with values less than 4096. Operators ('&' and '|') have equal precedence and bind left-to-right. Thus "[[:L:]-[a-z]-[\\u0100-\\u01FF]]" is equivalent to "[[[:L:]-[a-z]]-[\\u0100-\\u01FF]]". This only really matters for difference; intersection is commutative.
[a] | The set containing 'a' |
[a-z] | The set containing 'a' through 'z' and all letters in between, in Unicode order |
[^a-z] | The set containing all characters but 'a' through 'z', that is, U+0000 through 'a'-1 and 'z'+1 through U+10FFFF |
[[pat1][pat2]]
| The union of sets specified by pat1 and pat2 |
[[pat1]&[pat2]]
| The intersection of sets specified by pat1 and pat2 |
[[pat1]-[pat2]]
| The asymmetric difference of sets specified by pat1 and pat2 |
[:Lu:] or \p{Lu}
| The set of characters having the specified Unicode property; in this case, Unicode uppercase letters |
[:^Lu:] or \P{Lu}
| The set of characters not having the given Unicode property |
Formal syntax
pattern :=('[' '^'? item* ']') | propertyitem :=char | (char '-' char) | pattern-expr
pattern-expr :=pattern | pattern-expr pattern | pattern-expr op pattern
op :='&' | '-'
special :='[' | ']' | '-'
char :=any character that is not specialany character
| ('\\')
| ('\u' hex hex hex hex)
hex :='0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' |
'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f'property :=a Unicode property set pattern
Legend:
a := bamay be replaced byba?zero or one instance of a
a*one or more instances of a
a | beither aorb
'a'the literal string between the quotes
To iterate over contents of UnicodeSet, the following are available:
ranges() to iterate through the rangesstrings() to iterate through the stringsiterator() to iterate through the entire contents in a single loop.
That method is, however, not particularly efficient, since it "boxes" each code point into a String.
UnicodeSetIterator can also be used, but not in for loops.
To replace, count elements, or delete spans, see UnicodeSetSpanner.
UnicodeSetIterator, UnicodeSetSpanner
| Modifier and Type | Class and Description |
|---|---|
| public static enum | UnicodeSet.ComparisonStyle
Comparison style enums used by |
| public static class | UnicodeSet.EntryRange
A struct-like class used for iteration through ranges, for faster iteration than by String. |
| private class | |
| private class | |
| private static interface | |
| private static class | |
| private static class | |
| private static class | |
| private static class | |
| public static enum | UnicodeSet.SpanCondition
Argument values for whether span() and similar functions continue while the current character is contained vs. not contained in the set. |
| private static class | |
| private static class | |
| public abstract static class | UnicodeSet.XSymbolTable
Internal class for customizing UnicodeSet parsing of properties. |
| Modifier and Type | Field and Description |
|---|---|
| public static final int | ADD_CASE_MAPPINGS
Adds all case mappings for each element in the set. |
| public static final UnicodeSet | ALL_CODE_POINTS
Constant for the set of all code points. |
| private static final String | |
| private static final String | |
| private static final String | |
| private volatile BMPSet | |
| private int[] | |
| public static final int | CASE
Alias for |
| public static final int | CASE_INSENSITIVE
Enable case insensitive matching. |
| private static final int | |
| public static final UnicodeSet | EMPTY
Constant for the empty set. |
| private static final SortedSet | |
| private static final int | |
| public static final int | IGNORE_SPACE
Bitmask for constructor and applyPattern() indicating that white space should be ignored. |
| private static final int | INITIAL_CAPACITY
Enough for sets with few ranges. |
| private static final int | |
| private static final int | |
| private static final int | |
| private int | |
| private int[] | |
| private static final int | |
| private static final int | |
| private static final int | MAX_LENGTH
Max list [0, 1, 2, ..., max code point, HIGH] |
| public static final int | MAX_VALUE
Maximum value that can be stored in a UnicodeSet. |
| public static final int | MIN_VALUE
Minimum value that can be stored in a UnicodeSet. |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final VersionInfo | |
| private String | pat
The pattern representation of this set. |
| private int[] | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| public static final int | SIMPLE_CASE_INSENSITIVE
Enable case insensitive matching. |
| pack-priv SortedSet | |
| private volatile UnicodeSetStringSpan | |
| private static UnicodeSet. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | UnicodeSet(int
first character, inclusive, of range start, int last character, inclusive, of range end)Constructs a set containing the given range. |
| public | UnicodeSet(int...
pairs of character representing ranges pairs)Quickly constructs a set from a set of ranges <s0, e0, s1, e1, s2, e2, ..., sn, en>. |
| public | UnicodeSet(String
a string specifying what characters are in the set pattern)Constructs a set from the given pattern. |
| public | UnicodeSet(String
a string specifying what characters are in the set pattern, boolean if true, ignore Unicode Pattern_White_Space characters ignoreWhitespace)Constructs a set from the given pattern. |
| public | UnicodeSet(String
a string specifying what characters are in the set pattern, int a bitmask indicating which options to apply.
Valid options are options)IGNORE_SPACE and
at most one of CASE_INSENSITIVE, ADD_CASE_MAPPINGS,
SIMPLE_CASE_INSENSITIVE. These case options are mutually exclusive.Constructs a set from the given pattern. |
| public | UnicodeSet(String
a string specifying what characters are in the set pattern, ParsePosition on input, the position in pattern at which to start parsing.
On output, the position after the last character parsed. pos, SymbolTable a symbol table mapping variables to char[] arrays
and chars to UnicodeSets symbols)Constructs a set from the given pattern. |
| public | UnicodeSet(String
a string specifying what characters are in the set pattern, ParsePosition on input, the position in pattern at which to start parsing.
On output, the position after the last character parsed. pos, SymbolTable a symbol table mapping variables to char[] arrays
and chars to UnicodeSets symbols, int a bitmask indicating which options to apply.
Valid options are options)IGNORE_SPACE and
at most one of CASE_INSENSITIVE, ADD_CASE_MAPPINGS,
SIMPLE_CASE_INSENSITIVE. These case options are mutually exclusive.Constructs a set from the given pattern. |
| Modifier and Type | Method and Description |
|---|---|
| private static <T extends Appendable> T | _appendToPat(T buf, String s, boolean escapeUnprintable)
Append the |
| private static <T extends Appendable> T | _appendToPat(T buf, int c, boolean escapeUnprintable)
Append the |
| private static <T extends Appendable> T | |
| public StringBuffer | _generatePattern(StringBuffer
the buffer into which to generate the pattern result, boolean escape unprintable characters if true escapeUnprintable)Generate and append a string representation of this set to result. |
| public StringBuffer | _generatePattern(StringBuffer
the buffer into which to generate the pattern result, boolean escape unprintable characters if true escapeUnprintable, boolean if false, doesn't include the strings. includeStrings)Generate and append a string representation of this set to result. |
| private <T extends Appendable> T | _toPattern(T result, boolean escapeUnprintable)
Append a string representation of this set to result. |
| public UnicodeSet | add(int
first character, inclusive, of range to be added
to this set. start, int last character, inclusive, of range to be added
to this set. end)Adds the specified range to this set if it is not already present. |
| public final UnicodeSet | |
| public final UnicodeSet | Returns: this object, for chainingthe source string s)Adds the specified multicharacter to this set if it is not already present. |
| public UnicodeSet | |
| private UnicodeSet | |
| private UnicodeSet | |
| private final UnicodeSet | |
| public UnicodeSet | Returns: a reference to this objectThe index of where to start on adding all characters. start, int The index of where to end on adding all characters. end)Adds all characters in range (uses preferred naming convention). |
| public final UnicodeSet | Returns: this object, for chainingthe source string s)Adds each of the characters in this string to the set. |
| public UnicodeSet | addAll(UnicodeSet
set whose elements are to be added to this set. c)Adds all of the elements in the specified set to this set if they're not already present. |
| public UnicodeSet | |
| public <T extends CharSequence> UnicodeSet | |
| public <T extends Collection | addAllTo(T
collection to add into target)Add the contents of the UnicodeSet (as strings) into a collection. |
| public String[] | |
| public static <T, U extends Collection | |
| public static <T> T[] | |
| public UnicodeSet | Returns: the input set, modifiedSet with the don't-care characters for spanning dontCare)
Deprecated
This API is ICU internal only.
Simplify the ranges in a Unicode set by merging any ranges that are only separated by characters in the dontCare set.
|
| private static final void | |
| public void | addMatchSetTo(UnicodeSet
the set into which to union the source characters toUnionTo)Implements com. |
| private void | |
| private static void | |
| private static void | appendCodePoint(Appendable app, int c)
Todo create Appendable version of UTF16.append(buf, c), maybe in new class Appendables? |
| private <T extends Appendable> T | |
| private void | applyFilter(UnicodeSet.
Generic filter-based scanning code for UCD property UnicodeSets. |
| public UnicodeSet | Returns: a reference to this seta property in the range
UProperty.BIN_START..UProperty.BIN_LIMIT-1 or
UProperty.INT_START..UProperty.INT_LIMIT-1 or.
UProperty.MASK_START..UProperty.MASK_LIMIT-1. prop, int a value in the range
UCharacter.getIntPropertyMinValue(prop)..
UCharacter.getIntPropertyMaxValue(prop), with one exception.
If prop is UProperty.GENERAL_CATEGORY_MASK, then value should not be
a UCharacter.getType() result, but rather a mask value produced
by logically ORing (1 << UCharacter.getType()) values together.
This allows grouped categories such as [:L:] to be represented. value)Modifies this set to contain those code points which have the given value for the given binary or enumerated property, as returned by UCharacter.getIntPropertyValue. |
| public final UnicodeSet | applyPattern(String
a string specifying what characters are in the set pattern)Modifies this set to represent the set specified by the given pattern. |
| public UnicodeSet | applyPattern(String
a string specifying what characters are in the set pattern, boolean if true then Unicode Pattern_White_Space characters are ignored ignoreWhitespace)Modifies this set to represent the set specified by the given pattern, optionally ignoring whitespace. |
| public UnicodeSet | applyPattern(String
a string specifying what characters are in the set pattern, int a bitmask indicating which options to apply.
Valid options are options)IGNORE_SPACE and
at most one of CASE_INSENSITIVE, ADD_CASE_MAPPINGS,
SIMPLE_CASE_INSENSITIVE. These case options are mutually exclusive.Modifies this set to represent the set specified by the given pattern, optionally ignoring whitespace. |
| public UnicodeSet | Returns: an inversion list for the parsed substring ofpatternthe string containing the pattern to be parsed. The
portion of the string from pos.getIndex(), which must be a '[', to the
corresponding closing ']', is parsed. pattern, ParsePosition upon entry, the position at which to being parsing. The
character at pattern.charAt(pos.getIndex()) must be a '['. Upon return
from a successful parse, pos.getIndex() is either the character after the
closing ']' of the parsed pattern, or pattern.length() if the closing ']'
is the last character of the pattern string. pos, SymbolTable symbols, int options)
Deprecated
This API is ICU internal only.
Parses the given pattern, starting at the given position.
|
| private void | applyPattern(RuleCharacterIterator
iterator over the pattern characters. Upon return
it will be advanced to the first character after the parsed
pattern, or the end of the iteration if all characters are
parsed. chars, SymbolTable symbol table to use to parse and dereference
variables, or null if none. symbols, Appendable the pattern that was parsed, rebuilt or
copied from the input pattern, as appropriate. rebuiltPat, int a bit mask.
Valid options are options, int depth)IGNORE_SPACE and
at most one of CASE_INSENSITIVE, ADD_CASE_MAPPINGS,
SIMPLE_CASE_INSENSITIVE. These case options are mutually exclusive.Parse the pattern from the given RuleCharacterIterator. |
| public UnicodeSet | Returns: a reference to this seta property alias, either short or long.
The name is matched loosely. See PropertyAliases.txt for names
and a description of loose matching. If the value string is
empty, then this string is interpreted as either a
General_Category value alias, a Script value alias, a binary
property alias, or a special ID. Special IDs are matched
loosely and correspond to the following sets:
"ANY" = [\\u0000-\\U0010FFFF],
"ASCII" = [\\u0000-\\u007F]. propertyAlias, String a value alias, either short or long. The
name is matched loosely. See PropertyValueAliases.txt for
names and a description of loose matching. In addition to
aliases listed, numeric values and canonical combining classes
may be expressed numerically, e.g., ("nv", "0.5") or ("ccc",
"220"). The value string may also be empty. valueAlias)Modifies this set to contain those code points which have the given value for the given property. |
| public UnicodeSet | Returns: this setA string of the property alias. propertyAlias, String A string of the value alias. valueAlias, SymbolTable if not null, then symbols are first called to see if a property
is available. If true, then everything else is skipped. symbols)Modifies this set to contain those code points which have the given value for the given property. |
| private UnicodeSet | applyPropertyPattern(String pattern, ParsePosition ppos, SymbolTable
TODO symbols)Parse the given property pattern at the given parse position. |
| private void | applyPropertyPattern(RuleCharacterIterator
iterator over the pattern characters. Upon return
it will be advanced to the first character after the parsed
pattern, or the end of the iteration if all characters are
parsed. chars, Appendable the pattern that was parsed, rebuilt or
copied from the input pattern, as appropriate. rebuiltPat, SymbolTable TODO symbols)Parse a property pattern. |
| public int | Returns: the character at the given index, or -1.an index from 0..size()-1 index)Returns the character at the given index within this set, where the set is ordered by ascending code point. |
| private void | |
| public UnicodeSet | |
| public Object | |
| public UnicodeSet | Returns: the clone, not frozenImplements com. |
| public UnicodeSet | Returns: a reference to this set.bitmask for attributes to close over.
Valid options:
At most one of attribute)CASE_INSENSITIVE, ADD_CASE_MAPPINGS,
SIMPLE_CASE_INSENSITIVE. These case options are mutually exclusive.
Unrelated options bits are ignored.Close this set over the given attribute. |
| private void | |
| private void | |
| public UnicodeSet | compact()
Reallocate this objects internal structures to take up the least possible space, without changing this object's value. |
| public static int | |
| public static int | |
| public static <T extends Comparable | |
| public static <T extends Comparable | |
| public static <T extends Comparable | compare(Collection<T> collection1, Collection<T> collection2, UnicodeSet.
Utility to compare two collections, optionally by size, and then lexicographically. |
| public int | compareTo(UnicodeSet
the object to be compared. o)Implements java. |
| public int | compareTo(UnicodeSet o, UnicodeSet.
Compares UnicodeSets, in three different ways. |
| public int | compareTo(Iterable<String>
the object to be compared. other)Implements java. |
| public UnicodeSet | complement(int
first character, inclusive, of range start, int last character, inclusive, of range end)Complements the specified range in this set. |
| public final UnicodeSet | |
| public UnicodeSet | |
| public final UnicodeSet | Returns: this object, for chainingthe string to complement s)Complement the specified string in this set. |
| public final UnicodeSet | Returns: this object, for chainingthe source string s)Complement EACH of the characters in this string. |
| public UnicodeSet | complementAll(UnicodeSet
set that defines which elements will be complemented from
this set. c)Complements in this set all elements contained in the specified set. |
| public boolean | Returns: true if the test condition is metcharacter to be checked for containment c)Implements abstract com. |
| public boolean | Returns: true if the test condition is metfirst character, inclusive, of the range start, int last character, inclusive, of the range end)Returns true if this set contains every character of the given range. |
| public final boolean | Returns: true if this set contains the specified stringstring to be checked for containment s)Returns true if this set contains the given multicharacter string. |
| public boolean | Returns: true if the test condition is metset to be checked for containment b)Returns true if this set contains all the characters and strings of the given set. |
| public boolean | Returns: true if the test condition is metstring containing characters to be checked for containment s)Returns true if there is a partition of the string such that this set contains each of the partitioned strings. |
| private boolean | Returns: true if oksource string s, int point to match to the end on i)Recursive routine called if we fail to find a match in containsAll, and there are strings |
| public <T extends CharSequence> boolean | |
| public boolean | Returns: true if the test condition is metfirst character, inclusive, of the range start, int last character, inclusive, of the range end)Returns true if this set contains none of the characters of the given range. |
| public boolean | Returns: true if the test condition is metset to be checked for containment b)Returns true if none of the characters or strings in this UnicodeSet appears in the string. |
| public boolean | Returns: true if the test condition is metstring containing characters to be checked for containment s)Returns true if this set contains none of the characters of the given string. |
| public <T extends CharSequence> boolean | |
| public final boolean | Returns: true if the condition is metfirst character, inclusive, of the range start, int last character, inclusive, of the range end)Returns true if this set contains one or more of the characters in the given range. |
| public final boolean | Returns: true if the condition is metset to be checked for containment s)Returns true if this set contains one or more of the characters and strings of the given set. |
| public final boolean | Returns: true if the condition is metstring containing characters to be checked for containment s)Returns true if this set contains one or more of the characters of the given string. |
| public final <T extends CharSequence> boolean | |
| private void | |
| private void | |
| public boolean | Returns: true if the specified Object is equal to this set.Object to be compared for equality with this set. o)Overrides java. |
| private final int | Returns: the smallest integer i in the range 0..len-1, inclusive, such that c < list[i]a character in the range MIN_VALUE..MAX_VALUE
inclusive c)Returns the smallest value i such that c < list[i]. |
| public int | findIn(CharSequence value, int fromIndex, boolean findNot)
Deprecated
This API is ICU internal only. Use span instead.
Find the first index at or after fromIndex where the UnicodeSet matches at that index.
|
| public int | findLastIn(CharSequence value, int fromIndex, boolean findNot)
Deprecated
This API is ICU internal only. Use spanBack instead.
Find the last index before fromIndex where the UnicodeSet matches at that index.
|
| public UnicodeSet | Returns: thisImplements com. |
| public static UnicodeSet | Returns: a newly created set containing the given stringthe source string s)Makes a set from a multicharacter string. |
| public static UnicodeSet | Returns: a newly created set containing the given charactersthe source string s)Makes a set from each of the characters in the string. |
| public static UnicodeSet. | Returns: the symbol table
Deprecated
This API is ICU internal only.
Get the default symbol table.
|
| public int | |
| public int | getRangeEnd(int index)
Iteration method that returns the last character in the specified range of this set. |
| public int | getRangeStart(int index)
Iteration method that returns the first character in the specified range of this set. |
| public String | Returns: regex pattern equivalent to this UnicodeSet
Deprecated
This API is ICU internal only.
Get the Regex equivalent for this UnicodeSet
|
| public static int | getSingleCodePoint(CharSequence s)
Deprecated
This API is ICU internal only.
Return the value of the first code point, if the string is exactly one code point.
|
| private static int | Returns: a code point IF the string consists of a single one. otherwise returns -1.to test s)Utility for getting code point from single code point CharSequence. |
| public int | Returns: the hash code value for this set.Overrides java. |
| public boolean | |
| public int | Returns: an index from 0..size()-1, or -1Returns the index of the given character within this set, where the set is ordered by ascending code point. |
| public boolean | Returns: true if this set contains no elements.Returns true if this set contains no elements. |
| public boolean | Returns: valueImplements com. |
| public Iterator | |
| public int | matches(Replaceable
the text to be matched text, 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. offset, 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. limit, 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. incremental)Overrides com. Implements com. |
| public int | matchesAt(CharSequence text, int offset)
Deprecated
This API is ICU internal only.
Tests whether the text matches at the offset.
|
| private static int | Returns: -1 if match fails, otherwise other.length()text to match text, int offset within that text offsetInText, CharSequence substring to match at offset in text substring)Does one string contain another, starting at a specific offset? |
| public boolean | matchesIndexValue(int v)
Implements com. |
| private static int | Returns: If part of s matches up to the limit, return |limit - start|. If all of s matches before reaching the limit, return s.length(). If there is a mismatch between s and text, return 0the text to match text, int the first character to match. In the forward
direction, text.charAt(start) is matched against s.charAt(0).
In the reverse direction, it is matched against
s.charAt(s.length()-1). start, int the limit offset for matching, either last+1 in
the forward direction, or last-1 in the reverse direction,
where last is the index of the last character to match. limit, String s)Returns the longest match for s in text at the given position. |
| private static final int | |
| pack-priv UnicodeSet | maybeOnlyCaseSensitive(UnicodeSet src)
For case closure on a large set, look only at code points with relevant properties. |
| private static String | mungeCharName(String source)
Remove leading and trailing Pattern_White_Space and compress internal Pattern_White_Space to a single space character. |
| private int | |
| private int[] | |
| public Iterable | |
| public UnicodeSet | remove(int
first character, inclusive, of range to be removed
from this set. start, int last character, inclusive, of range to be removed
from this set. end)Removes the specified range from this set if it is present. |
| public final UnicodeSet | Returns: this object, for chainingthe character to be removed c)Removes the specified character from this set if it is present. |
| public final UnicodeSet | Returns: this object, for chainingthe string to be removed s)Removes the specified string from this set if it is present. |
| public final UnicodeSet | Returns: this object, for chainingthe source string s)Remove EACH of the characters in this string. |
| public UnicodeSet | removeAll(UnicodeSet
set that defines which elements will be removed from
this set. c)Removes from this set all of its elements that are contained in the specified set. |
| public <T extends CharSequence> UnicodeSet | |
| public final UnicodeSet | |
| public static boolean | resemblesPattern(String pattern, int pos)
Return true if the given position, in the given pattern, appears to be the start of a UnicodeSet pattern. |
| private static boolean | resemblesPropertyPattern(String pattern, int pos)
Return true if the given position, in the given pattern, appears to be the start of a property set pattern. |
| private static boolean | resemblesPropertyPattern(RuleCharacterIterator
iterator over the pattern characters. Upon return
it will be unchanged. chars, int RuleCharacterIterator options iterOpts)Return true if the given iterator appears to point at a property pattern. |
| public UnicodeSet | retain(int
first character, inclusive, of range start, int last character, inclusive, of range end)Retain only the elements in this set that are contained in the specified range. |
| public final UnicodeSet | Returns: this object, for chainingthe character to be retained c)Retain the specified character from this set if it is present. |
| public final UnicodeSet | Returns: this object, for chainingthe string to be retained cs)Retain the specified string in this set if it is present. |
| private UnicodeSet | |
| public final UnicodeSet | Returns: this object, for chainingthe source string s)Retains EACH of the characters in this string. |
| public UnicodeSet | retainAll(UnicodeSet
set that defines which elements this set will retain. c)Retains only the elements in this set that are contained in the specified set. |
| public <T extends CharSequence> UnicodeSet | |
| private static final boolean | |
| public UnicodeSet | set(int
first character in the set, inclusive start, int last character in the set, inclusive end)Make this object represent the range |
| public UnicodeSet | set(UnicodeSet
a other)UnicodeSet whose value will be
copied to this objectMake this object represent the same set as |
| public static void | setDefaultXSymbolTable(UnicodeSet.
the new default symbol table. xSymbolTable
Deprecated
This API is ICU internal only.
Set the default symbol table.
|
| public int | Returns: the number of elements in this set (its cardinality).Returns the number of elements in this set (its cardinality) Note than the elements of a set may include both individual codepoints and strings. |
| public int | Returns: the length of the spanThe string to be spanned s, UnicodeSet.The span condition spanConditionSpan a string using this UnicodeSet. |
| public int | Returns: the string index which ends the span (i.e. exclusive)The string to be spanned s, int The start index that the span begins start, UnicodeSet.The span condition spanConditionSpan a string using this UnicodeSet. |
| public int | Returns: the limit (exclusive end) of the spanAn output-only object (must not be null) for returning the count. outCount)
Deprecated
This API is ICU internal only.
Same as span() but also counts the smallest number of set elements on any path across the span.
|
| public int | Returns: The string index which starts the span (i.e. inclusive).The string to be spanned s, UnicodeSet.The span condition spanConditionSpan a string backwards (from the end) using this UnicodeSet. |
| public int | Returns: The string index which starts the span (i.e. inclusive).The string to be spanned s, int The index of the char (exclusive) that the string should be spanned backwards fromIndex, UnicodeSet.The span condition spanConditionSpan a string backwards (from the fromIndex) using this UnicodeSet. |
| private int | spanCodePointsAndCount(CharSequence s, int start, UnicodeSet.
Deprecated
as a consequence of
OutputInt being deprecated.
|
| public Collection | |
| public String | Returns: The string after it has been stripped.The source of the CharSequence to strip from. source, boolean A boolean to either strip all that matches or don't match with the current UnicodeSet object. matches)
Deprecated
This API is ICU internal only. Use replaceFrom.
Strips code points from source.
|
| private static void | |
| public static String[] | |
| public String | toPattern(boolean
if true then convert unprintable
character to their hex escape representations, \\uxxxx or
\\Uxxxxxxxx. Unprintable characters are those other than
U+000A, U+0020..U+007E. escapeUnprintable)Implements com. |
| public String | toString()
Overrides java. |
| private UnicodeSet |