|
J avolution v5.2 (J2SE 1.5+) | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavolution.text.CharSet
public final class CharSet
This class represents a set of characters.
Instances of this class are typically used for parsing purpose
(faster than regular expressions for simple patterns). For example:
// Integration with Text.
Text number;
int exponentIndex = num.indexOfAny(CharSet.valueOf('e', 'E'));
// Integration with TextFormat.
public List<Integer> parse(CharSequence csq, TextFormat.Cursor cursor) {
FastTable<Integer> numbers = FastTable.newInstance();
while (cursor.skip(CharSet.WHITESPACES, csq)) {
numbers.add(TypeFormat.parseInt(csq, cursor));
}
return numbers;
}
| Field Summary | |
|---|---|
static CharSet |
EMPTY
Represents an empty character set. |
static CharSet |
ISO_CONTROLS
Represents ISO control characters according to Java (see Character.isISOControl(char)). |
static CharSet |
SPACES
Represents spaces characters according to Java (see Character.isSpaceChar(char)). |
static CharSet |
WHITESPACES
Represents white spaces characters according to Java (see Character.isWhitespace(char)). |
| Method Summary | |
|---|---|
boolean |
contains(char c)
Indicates if the specified character is contained by this character set. |
CharSet |
minus(CharSet that)
Returns the character set containing the characters from this character minus the characters from the character set specified. |
CharSet |
plus(CharSet that)
Returns the character set containing the characters from this character set plus the characters from the character set specified. |
static CharSet |
rangeOf(char first,
char last)
Returns the character set holding the characters in the specified range. |
java.lang.String |
toString()
Returns the textual representation of this character set. |
static CharSet |
valueOf(char... chars)
Returns the character set holding the specified characters. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final CharSet EMPTY
public static final CharSet WHITESPACES
Character.isWhitespace(char)).
public static final CharSet SPACES
Character.isSpaceChar(char)).
public static final CharSet ISO_CONTROLS
Character.isISOControl(char)).
| Method Detail |
|---|
public static CharSet valueOf(char... chars)
chars - the characters contained by this character set.
public static CharSet rangeOf(char first,
char last)
first - the first character.last - the last character.
java.lang.IllegalArgumentException - if first > lastpublic boolean contains(char c)
c - the character to test.
true if this character set contains the specified
character; false otherwise.public CharSet plus(CharSet that)
that - the set containing the characters to be added.
this + thatpublic CharSet minus(CharSet that)
that - the set containing the character to be removed.
this - thatpublic java.lang.String toString()
toString in class java.lang.Object
|
J avolution v5.2 (J2SE 1.5+) | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||