The code to use the win32 DLL is concise:
'Declaration:
Private myComparer = New myArraySort()
'Calling code:
VarrstrDirector iesLevel = Directory.GetDi rectories(parPa th)
Array.Sort(Varr strDirectoriesL evel, myComparer)
'Definition:
Imports System.Runtime. InteropServices
Public Class myArraySort
Implements System.Collecti ons.IComparer
Public Function Compare _ (contd.)
ByVal...
User Profile
Collapse
-
Hi IronRazer - Thanks for reply and I have looked at the code. I was constructing a parsing subroutine but decided to try another tack and searched with 'Visual Basic Sort Directories'. I found a simple answer dated 2009 which calls StrCmpLogicalW from the 'shlwapi.dll' library. It leaves a little niggle as it collates e.g. 'F22 2.txt' before 'F22.txt' which I would have thought was wrong. However, it solves the major issue e.g. getting chapter directories...Leave a comment:
-
Sorting strings with initial alphnumeric part producing alphabetic/numeric ordering?
How do i sort the strings
"Ch 3", "Ch 20a", "Ch 1 b", "Ch 10b"
into the order:
"Ch 1 b", "Ch 3", "Ch 10b", "Ch 20a"?
I have tried using e.g.:
Array.Sort(arra y1, StringComparer. Ordinal) but this produces the ASCII order:
"Ch 1 b", "Ch 10b", "Ch 20a", "Ch 3".
The strings are directory names...
No activity results to display
Show More
Leave a comment: