RuleBasedCollatorNameRuleBasedCollatorSynopsis
DescriptionThe RuleBasedCollator class is a concrete subclass of Collator that can compare strings using a table of rules. The rules for many locales already exist. To get a useful Collator for a given locale, use the getInstance(Locale) factory method of Collator. If you need a special-purpose Collator or a Collator for a new locale, you can create your own RuleBasedCollator from a string that represents the rules. The rules are expressed in three primary forms:
[relation] [text] [reset] [text] [modifier] The rules can be chained together. The only modifier is the @ character, which specifies that all diacriticals are sorted backwards, as in French. The valid relations are:
For example "<a<b" is two chained rules that state that 'a' is greater than all ignorable characters, and 'b' is greater than 'a'. To expand this rule to include capitals, use "<a,A<b,B". A reset, specified by the & character, is used to insert rules in an existing list of chained rules. For example, we can add a rule to sort 'e' with an umlaut (Unicode 0308) after plain 'e'. The existing rules might look like "<a<b<c<d<e<f". We can add the following reset, "&e;e\u0308", so that the complete rule table looks like "<a<b<c<d<e<f&e;e\u0308". Class Summary
public class java.text.RuleBasedCollator extends java.text.Collator { // Constructors public RuleBasedCollator(String rules); // Instance Methods public Object clone(); public int compare(String source, String target); public boolean equals(Object obj); public CollationElementIterator getCollationElementIterator( String source); public CollationKey getCollationKey(String source); public String getRules(); public int hashCode(); } ConstructorsRuleBasedCollatorpublic RuleBasedCollator(String rules) throws ParseException
Instance Methodsclonepublic Object clone()
comparepublic int compare(String source, String target)
equalspublic boolean equals(Object obj)
getCollationElementIterator
public CollationElementIterator getCollationElementIterator( String source)
getCollationKeypublic CollationKey getCollationKey(String source)
getRulespublic String getRules()
hashCodepublic int hashCode()
Inherited Methods
See AlsoCollationKey, CollationElementIterator, Collator, Locale, ParseException, String |
|