Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7594245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:22:05+00:00 2026-05-30T21:22:05+00:00

Is there a way to correctly sort international strings in Android? I use a

  • 0

Is there a way to correctly sort international strings in Android? I use a custom comparator, and a compareTo() method, but it’s not enough for me. I want letters like this “ö” to be displayed near “o”, but all of them are at the end of the list. How can I force the comparator to think they are similar to “o, a, etc…”?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T21:22:07+00:00Added an answer on May 30, 2026 at 9:22 pm

    To locale-sensitive string comaprision use Collator. From docs:

    Performs locale-sensitive string comparison. A concrete subclass,
    RuleBasedCollator, allows customization of the collation ordering by
    the use of rule sets.

    Example of comparing strings:

     Collator deCollator = Collator.getInstance(Locale.GERMANY); // or new Locale("pl", "PL") for polish locale ;)
     System.out.println(deCollator.compare("abcö", "abco"));
    

    prints 1.


    If you want to sort list of strings using above collator, you can write:

    final List<String> strings = Arrays.asList(
            "über", "zahlen", "können", "kreativ", "Äther", "Österreich");
    Collections.sort(strings, deCollator); // Collator implements Comparator
    System.out.println(strings);
    

    prints:

    [Äther, können, kreativ, Österreich, über, zahlen]
    

    EDIT: Just spotted that you are Polish, so Polish example below:

    final List<String> strings = Arrays.asList(
            "pięć", "piec", "Pieczka", "pięść", "pieczęć", "pieczątka");
    Collections.sort(strings, Collator.getInstance(new Locale("pl", "PL")));
    System.out.println(strings);
    // output: [piec, pieczątka, pieczęć, Pieczka, pięć, pięść]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have trouble finding way to correctly refactor this code so that there would
Is there any way to use AppleScript (or something else) to query currently running
Is there a way to sort on finish times for a race? I have
Is there a correct way in Windows Forms to flash a titlebar without having
HI, Is there any 'correct' way to convert an XElement to an XmlNode in
Is there a way in Cocoa that is currently considered best practice for creating
Is there some way to determine what file currently is being rendered by Rails
Is there a way to get which JSP is currently rendered, with JSTL or
Is there a way to get the list of currently running threads in objective-C?
Is there a way to query the current DATEFORMAT SQLServer 2005 is currently using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.