/** * Uses a Locale dependent Collator to generate a sort string * * @param str The string to parse * @return String the sort ordering text */ @Override public String filter(String str) { RuleBasedCollator collator = getCollator(); // Have we got a collator? if (collator != null) { int element; StringBuffer buf = new StringBuffer(); // Iterate through the elements of the collator CollationElementIterator iter = collator.getCollationElementIterator(str); while ((element = iter.next()) != CollationElementIterator.NULLORDER) { // Generate a hexadecimal string representation of the Collation element // This can then be compared in a text sort ;-) String test = Integer.toString(element, 16); buf.append(test); } return buf.toString(); } return str; }