Ticket #8953: sort_relations_with_accented_letters.patch
File sort_relations_with_accented_letters.patch, 1.4 KB (added by , 12 years ago) |
---|
-
src/org/openstreetmap/josm/tools/AlphanumComparator.java
1 1 package org.openstreetmap.josm.tools; 2 2 3 import java.text.Collator; 3 4 /* 4 5 * The Alphanum Algorithm is an improved sorting algorithm for strings 5 6 * containing numbers. Instead of sorting numbers in ASCII order like a standard … … 23 24 * 24 25 */ 25 26 import java.util.Comparator; 27 import java.util.Locale; 26 28 27 29 /** 28 30 * The Alphanum Algorithm is an improved sorting algorithm for strings … … 77 79 } else if (s2 == null) { 78 80 return 1; 79 81 } 80 82 81 83 int thisMarker = 0; 82 84 int thatMarker = 0; 83 85 int s1Length = s1.length(); … … 106 108 } 107 109 } 108 110 } else { 109 result = thisChunk.compareTo(thatChunk); 111 // Instantiate the collator 112 Collator compareOperator = Collator.getInstance(Locale.getDefault()); 113 // Compare regardless of accented letters 114 compareOperator.setStrength(Collator.SECONDARY); 115 result = compareOperator.compare(thisChunk, thatChunk); 110 116 } 111 117 112 118 if (result != 0) {