|
All Packages Class Hierarchy This Package Previous Next Index Class java.text.CollationElementIteratorjava.lang.Object | +----java.text.CollationElementIterator
CollationElementIterator class is used as an iterator
to walk through each character of an international string. Use the iterator
to return the ordering priority of the positioned character. The ordering
priority of a character, which we refer to as a key, defines how a character
is collated in the given collation object.
For example, consider the following in Spanish: And in German,"ca" -> the first key is key('c') and second key is key('a'). "cha" -> the first key is key('ch') and second key is key('a'). The key of a character is an integer composed of primary order(short), secondary order(byte), and tertiary order(byte). Java strictly defines the size and signedness of its primitive data types. Therefore, the static functions"дb"-> the first key is key('a'), the second key is key('e'), and the third key is key('b'). primaryOrder , secondaryOrder , and
tertiaryOrder return int , short ,
and short respectively to ensure the correctness of the key
value.
Example of the iterator usage, // get the first key of the string String str = "This is a test"; CollationElementIterator c = new CollationElementIterator(str, 0, str.length(), Collator.getInstance()); int primaryOrder = CollationElementIterator.primaryOrder(c->next());
NULLORDERpublic static final int NULLORDER
resetpublic void reset()
public int next()
public static final int primaryOrder(int order)
public static final short secondaryOrder(int order)
public static final short tertiaryOrder(int order)
All Packages Class Hierarchy This Package Previous Next Index Submit a bug or feature |
|||||||||||||||||
With any suggestions or questions please feel free to contact us |