| Factory method to create a new CharSet using a special syntax.
null or empty string ("")
- set containing no characters
- Single character, such as "a"
- set containing just that character
- Multi character, such as "a-e"
- set containing characters from one character to the other
- Negated, such as "^a" or "^a-e"
- set containing all characters except those defined
- Combinations, such as "abe-g"
- set containing all the characters from the individual sets
The matching order is:
- Negated multi character range, such as "^a-e"
- Ordinary multi character range, such as "a-e"
- Negated single character, such as "^a"
- Ordinary single character, such as "a"
Matching works left to right. Once a match is found the
search starts again from the next character.
If the same range is defined twice using the same syntax, only
one range will be kept.
Thus, "a-ca-c" creates only one range of "a-c".
If the start and end of a range are in the wrong order,
they are reversed. Thus "a-e" is the same as "e-a".
As a result, "a-ee-a" would create only one range,
as the "a-e" and "e-a" are the same.
The set of characters represented is the union of the specified ranges.
All CharSet objects returned by this method will be immutable.
Parameters: setStr - the String describing the set, may be null a CharSet instance since: 2.0 |