How to sort Alphanumeric String

前端 未结 11 1436
我寻月下人不归
我寻月下人不归 2020-12-10 06:25

I have a problem with sorting strings which include integers. If I use the below code I get sorting like: 1some, 2some, 20some, 21some, 3some, some

However I want it

11条回答
  •  粉色の甜心
    2020-12-10 06:54

    If you have alphanumeric string array you can directly sort it by using

    Arrays.sort(Array_name)
    

    and then to print:

    for(String a : Array_name)
        System.out.print(a);
    

提交回复
热议问题