coding
lcyssm的gravatar头像
lcyssm2015-02-13 12:15:19

Java实现按汉语拼音的排序的有用代码片段分享

public class sortByPinyin {
    public static void main(String[] args) {
          String[] arr = { "刘刘", "李飞", "王五", "老三", "贝贝", "啊三" };
          Collator cmp = Collator.getInstance(java.util.Locale.CHINA);
          Arrays.sort(arr, cmp);
          List<String> list = Arrays.asList(arr);
          System.out.println(list);
	}
}

打赏

顶部客服微信二维码底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友