Sorting String with non-western characters

前端 未结 6 1786
醉话见心
醉话见心 2020-12-15 01:49

I wanted to print sorted Polish names of all available languages.

import java.util.*;

public class Tmp
{
  public static void main(String... args)
  {
    L         


        
6条回答
  •  别那么骄傲
    2020-12-15 01:54

    Something like this

    val polishCollator = yourCollection.sortedWith(Comparator { s1, s2 ->
                Collator.getInstance(Locale("pl", "PL")).compare(s1,s2)
            })
    

提交回复
热议问题