Jump to content
Sign in to follow this  
dotAge

Simplified Chinese sorting

Recommended Posts

Hi,

 

Chinese usually sort word by Pingyin or strokes, but now in Poweramp I don't know what is it sorted by. It is very hard to find out a file quickly in a long music directory.

Did you use the right Collator object for the Simplified chinese?

 

Code snippet for your reference:
  1. final Collator chinaCollator = Collator  
  2.         .getInstance(java.util.Locale.CHINA);  
  3. Collections.sort(folderItems, new Comparator<Map<String, V>>() {  
  4.     @Override  
  5.     public int compare(Map<String, V> map1, Map<String, V> map2) {  
  6.         String name1 = map1.get("name").toString();  
  7.         String name2 = map2.get("name").toString();  
  8.         return chinaCollator.compare(name1.toLowerCase(),  
  9.                 name2.toLowerCase());  
  10.     }  
  11. });  

 

Best Regards,

dotAge

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...