js
var names = ["王五", "李四", "赵六", "张三", "郝七", "陈二", "蔡八", "孙九", "黄十", "路一"]; // 中文姓氏排序 names.sort(function(a, b) { return a.localeCompare(b,"zh"); });
java
List<String> names = Arrays.asList("王五", "李四", "赵六", "张三", "郝七", "陈二", "蔡八", "孙九", "黄十", "路一"); Collator collator = Collator.getInstance(Locale.CHINA); Collections.sort(names, collator); for (String name : names) { System.out.println(name); }