Java编程实现汉字按字母顺序排序的方法示例-创新互联

本文实例讲述了Java编程实现汉字按字母顺序排序的方法。分享给大家供大家参考,具体如下:

创新互联是一家专注于网站制作、成都网站设计与策划设计,广陵网站建设哪家好?创新互联做网站,专注于网站建设10多年,网设计领域的专业建站公司;建站业务涵盖:广陵等地区。广陵做网站价格咨询:13518219792
String[] str0 = new String[]{"abd","ervcd","sdfc","abdc","sded","生活","文教","政治"};
String[] str1 = new String[]{"生活","文教","政治","自然","宗教"};
String[] str2 = new String[]{"张三","李四","王五","自然","戴阿","戴生"};
String[] str3 = new String[]{"李四","张三","繁體字","無效","對繁","軍事","經貿"};
//对简体字有效,对繁体字无效
Comparator comp = Collator.getInstance(java.util.Locale.CHINESE);
Arrays.sort(str0, comp);
Arrays.sort(str1, comp);
Arrays.sort(str2, comp);
Arrays.sort(str3, comp);
for(int i=0;i                
网站栏目:Java编程实现汉字按字母顺序排序的方法示例-创新互联
标题网址:http://azwzsj.com/article/dhjjhd.html