How can I use the Unicode Collation Algorithm for a stable sort?
A stable sort is one where identical records come out in the same order as they were originally in. To achieve this, the easiest way is to append an index number for each record to the sort key for that record. Whether that sort key comes from strings, other data, or a concatenation of sort keys, it will then produce a stable sort. Further information about stable sorts and related topics can be found in Deterministic Sorting.
Related Questions
- UTS #10 Unicode Collation Algorithm is defined with a particular base version of the Unicode Standard, but I am using characters from a later version of Unicode. What shall I do?
- My script does not sort right because the characters were assigned to Unicode code points in the wrong order. What can I do about that?
- Are Unicode Named Character Sequences guaranteed to be stable?