简单的中文字符串排序

public class Test4 {
    @SuppressWarnings({ "rawtypes", "unchecked" })
    public static void main(String[] args) {
        int i=0;
        String[] strs={"张三","李四","王五"};
        Comparator c=Collator.getInstance(Locale.CHINA);
        Arrays.sort(strs,c);
        for (String str : strs) {
            System.out.println((++i)+"、"+str);
        }
    }

}

输出结果:

QQ图片20160428145430

posted @ 2016-04-28 14:57  涉务  阅读(299)  评论(0编辑  收藏  举报