aspose file tools*
The moose likes Java in General and the fly likes Collections.sort in java using locale ???? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Collections.sort in java using locale ????" Watch "Collections.sort in java using locale ????" New topic
Author

Collections.sort in java using locale ????

Frank Jacobsen
Ranch Hand

Joined: May 17, 2002
Posts: 356
I Want to sort a list, with a danish locale, but when i try to sort like this it sort First "�" then "�" then "�" the exact wrong way, can i give a locale or how do i sort this list correct:





Frank
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Locale-specific String comparison can only be done using a Collator I think. If you get a Collator for a Danish Locale and have your SortTekstComparator test for ordering with Collator.compare(element1, element2) instead you should see the results you expect.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Collections.sort in java using locale ????