public final class UnicodeSet extends Object implements Serializable
| Modifier and Type | Field and Description |
|---|---|
static UnicodeSet |
ALNUM
Character set that contains alphanumeric characters.
|
static UnicodeSet |
ALPHA
Character set that contains ASCII letters.
|
static UnicodeSet |
ASCII
Character set that contains all ASCII characters.
|
static UnicodeSet |
DIGIT
Character set that contains ASCII digits.
|
static UnicodeSet |
EMPTY
Empty character set.
|
static int |
MAX_ELEMENT
The maximum value of a unicode code point.
|
static int |
MIN_ELEMENT
The minimum value of a unicode code point.
|
static UnicodeSet |
PRINT
Character set that contains printable ASCII characters.
|
static UnicodeSet |
SPACE
Character set that contains ASCII whitespace characters.
|
static UnicodeSet |
WHOLE
Character set that contains all unicode characters.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(int ch)
Determines if this character set contains the specified character.
|
boolean |
equals(Object obj)
Determines if this character set equals to the specified one.
|
static String |
escape(char ch)
Adds escape (
\) character to the specified one if needed. |
static String |
escape(String source)
Adds escape (
\) characters to the specified string. |
static StringBuilder |
escape(String source,
StringBuilder buf)
Adds escape (
\) characters to the specified string and
appends result to the specified buffer. |
static UnicodeSet |
fromElements(char... elements)
Creates a new character set from the specified array of characters.
|
static UnicodeSet |
fromElements(int[] elements)
Creates a new character set from the specified array of characters.
|
static UnicodeSet |
fromElements(String elements)
Creates a new character set from the specified string of characters.
|
static UnicodeSet |
fromIntervals(char... intervals)
Creates a new character set from the specified array of intervals.
|
static UnicodeSet |
fromIntervals(int[] intervals)
Creates a new character set from the specified array of intervals.
|
int |
getMax()
Returns maximum bound for this character set.
|
int |
getMin()
Returns minimum bound for this character set.
|
int |
hashCode()
Returns a hash code value for this character set.
|
UnicodeSet |
inverse()
Returns inverse character set for this character set.
|
boolean |
isElementSet()
Determines if this character set represents a set of single characters.
|
int |
size()
Returns number of intervals for this character set.
|
int[] |
toArray()
Returns array that contains all intervals of this character set.
|
String |
toString()
Returns string representing this character set.
|
void |
toString(StringBuilder buf)
Appends string representation of this character set to the specified
buffer.
|
static String |
unescape(String source)
Removes escape (
\) characters from the specified string. |
static StringBuilder |
unescape(String source,
StringBuilder buf)
Removes escape (
\) characters from the specified string and
appends result to the specified buffer. |
UnicodeSet |
union(UnicodeSet uset)
Merges this character set with the specified one and returns a new
character set.
|
static UnicodeSet |
unionAll(UnicodeSet... usets)
Merges the specified character sets and returns a new character set.
|
public static final int MIN_ELEMENT
public static final int MAX_ELEMENT
public static final UnicodeSet EMPTY
public static final UnicodeSet WHOLE
public static final UnicodeSet ASCII
public static final UnicodeSet DIGIT
public static final UnicodeSet ALPHA
public static final UnicodeSet ALNUM
public static final UnicodeSet SPACE
public static final UnicodeSet PRINT
public int size()
public int getMin()
public int getMax()
public boolean isElementSet()
true if this character set represents a set of
single characters; false otherwise.public boolean contains(int ch)
ch - Character to be tested.true if this character set contains the specified
character; false otherwise.public UnicodeSet union(UnicodeSet uset)
uset - Character set to merge.public UnicodeSet inverse()
public int hashCode()
public boolean equals(Object obj)
public int[] toArray()
public String toString()
public void toString(StringBuilder buf)
buf - Buffer to append.public static UnicodeSet unionAll(UnicodeSet... usets)
usets - Character sets to merge.public static UnicodeSet fromElements(char... elements)
elements - Array of characters.public static UnicodeSet fromElements(int[] elements)
elements - Array of characters.public static UnicodeSet fromElements(String elements)
elements - String of characters.public static UnicodeSet fromIntervals(char... intervals)
intervals - Array of intervals.IllegalArgumentException - if length of the specified array of
intervals is invalid.public static UnicodeSet fromIntervals(int[] intervals)
intervals - Array of intervals.IllegalArgumentException - if length of the specified array of
intervals is invalid.public static String escape(char ch)
\) character to the specified one if needed.ch - Source character.public static String escape(String source)
\) characters to the specified string.source - Source string.escape(String, StringBuilder)public static StringBuilder escape(String source, StringBuilder buf)
\) characters to the specified string and
appends result to the specified buffer.source - Source string.buf - Buffer to append.escape(char)public static String unescape(String source)
\) characters from the specified string.source - Source string.IllegalArgumentException - if the specified string is malformed.unescape(String, StringBuilder)public static StringBuilder unescape(String source, StringBuilder buf)
\) characters from the specified string and
appends result to the specified buffer.source - Source string.buf - Buffer to append.IllegalArgumentException - if the specified string is malformed.Copyright © 2010-2012 FoxLabs. All Rights Reserved.