Click here to Skip to main content
15,897,891 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Friends

i have developing window application for processing folder.In that i want to sort folder name.my folder name is like the below:
VB
ctt2dzcz6
ctt2dzcz6.1
ctt2dzcz6.2
ctt2dzcz6.3
ctt2dzcz6.4
ctt2dzcz6.5
ctt2dzcz6.6
ctt2dzcz6.7
ctt2dzcz6.8
ctt2dzcz6.9
ctt2dzcz6.10
ctt2dzcz6.11

i have tried to store the names in array and sort it.but it will be like the below
VB
ctt2dzcz6
ctt2dzcz6.1
ctt2dzcz6.10
ctt2dzcz6.11
ctt2dzcz6.2
ctt2dzcz6.3
ctt2dzcz6.4
ctt2dzcz6.5
ctt2dzcz6.6
ctt2dzcz6.7
ctt2dzcz6.8
ctt2dzcz6.9
</pre>


How to sort it ?
is it possible to split and sort?
how to sort the file name?
Posted
Updated 16-Apr-13 22:01pm
v2

1 solution

That is always a PITA - string sort order is different from numeric sort order, so you can't directly sort by extension the way you want, even if it contains only numeric digits.
Have a look at this: Numeric String Sort in C#[^] - it sorts the "wrong" part of the file name for you, but it should be pretty easy for you to change!
 
Share this answer
 
Comments
jai_mca 17-Apr-13 6:56am    
Thanks a lot OriginalGriff..
it's wonderful..
OriginalGriff 17-Apr-13 6:57am    
You're welcome!
jai_mca 17-Apr-13 7:18am    
is it possible without dll?
OriginalGriff 17-Apr-13 7:47am    
Do you mean shlwapi.dll?
Because the code doesn't use it - it just mentions that it replaces it's functionality.
If not, what do you mean?
jai_mca 17-Apr-13 23:48pm    
understood friend..once again thanks..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900