String englishRules =
("< a,A < b,B < c,C < d,D < e,E < f,F " +
"< g,G < h,H < i,I < j,J < k,K < l,L " +
"< m,M < n,N < o,O < p,P < q,Q < r,R " +
"< s,S < t,T < u,U < v,V < w,W < x,X " +
"< y,Y < z,Z");
String smallnTilde = new String("\u00F1");
String capitalNTilde = new String("\u00D1");
String traditionalSpanishRules =
("< a,A < b,B < c,C " +
"< ch, cH, Ch, CH " +
"< d,D < e,E < f,F " +
"< g,G < h,H < i,I < j,J < k,K < l,L " +
"< ll, lL, Ll, LL " +
"< m,M < n,N " +
"< " + smallnTilde + "," + capitalNTilde + " " +
"< o,O < p,P < q,Q < r,R " +
"< s,S < t,T < u,U < v,V < w,W < x,X " +
"< y,Y < z,Z");
String [] words = {
"luz",
"curioso",
"llama",
"chalina"
};
try {
RuleBasedCollator enCollator =
new RuleBasedCollator(englishRules);
RuleBasedCollator spCollator =
new RuleBasedCollator(traditionalSpanishRules);
sortStrings(enCollator, words);
printStrings(words);
System.out.println();
sortStrings(spCollator, words);
printStrings(words);
} catch (ParseException pe) {
System.out.println("Parse exception for rules");
}