Hello everyone,
I’ve some array data of filename to sort by descending.
Example of filename: A_1.xlsx, A_5.xlsx, A_2.xlsx
Expectation: A_1.xlsx, A_2.xlsx, A_5.xlsx
Can you help me?
Regards,
Brian H
Hello everyone,
I’ve some array data of filename to sort by descending.
Example of filename: A_1.xlsx, A_5.xlsx, A_2.xlsx
Expectation: A_1.xlsx, A_2.xlsx, A_5.xlsx
Can you help me?
Regards,
Brian H
Try this
For getting descending array list
(From item In yourArray Select item Order By item Descending).ToArray
For Gettinng Ascending Array list
(From item In yourArray Select item Order By item Ascending).ToArray
Regards
Sudharsan
Hello @brian_satijadi ,
You can use the below expression :
Output_Array = Input_Array.Orderby(function(x) x)
Thanks,
Rohith
currently not present within your sample but affected with the approach is following:
the function is sorting the files lexically so the A_2 is before the A_10
We would recommend to clear following:
In general we will use the OrderByDescending method, but will adapt on the parts which we are providing for the ordering
Arr_Files.OrderByDescending(Function(F) CInt(Path.GetFileNameWithoutExtenstion(F).Split("_"c)(1))).Toarray