JAVA按数字,字母排序,但不包括大小写和汉字排序

public class ABC {
public static void main(String[] args) {
new ABC().sortStringArray();
}
public void sortStringArray(){
String[] a = new String[]{"Oscar", "Charlie", "Ryan",
"Adam", "David","aff","Aff","12","斗鱼","阿里巴巴","aaa","9527"};
System.out.println();
System.out.println("字符型数组排序,排序前:");
for (int i = 0;i < a.length;i++){
System.out.println(a[i] + ",");
}
System.out.println();
System.out.println("排序后;");
// 调用数组的静态排序方法sort,且不区分大小写
Arrays.sort(a,String.CASE_INSENSITIVE_ORDER);
for (int i = 0;i < a.length;i++){
System.out.println(a[i] + ",");
}
}
}

转载于:https://www.cnblogs.com/THEONLYLOVE/p/9114838.html

你可能感兴趣的:(JAVA按数字,字母排序,但不包括大小写和汉字排序)