Jump to content

Simplified Chinese sorting


dotAge

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

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...