File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Collections.sort in java using locale ????

 
Frank Jacobsen
Ranch Hand
Posts: 358
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic