本帖最后由 ps122 于 2022-2-24 21:16 编辑
试试看应该可以:
[Visual Basic .NET] 纯文本查看 复制代码 Public Class nvSorter
Implements IComparer(Of String)
Dim k As Int16 = 1
Public Sub New(ByVal x0 As Int16)
k = x0
End Sub
Declare Unicode Function StrCmpLogicalW Lib "shlwapi.dll" (ByVal s1 As String, ByVal s2 As String) As Int32
Public Function Compare(ByVal x As String, ByVal y As String) As Integer Implements System.Collections.Generic.IComparer(Of String).Compare
Return k * StrCmpLogicalW(x, y)
End Function
End Class
[Visual Basic .NET] 纯文本查看 复制代码 list.Sort(New nvSorter(1)) '升序
list.Sort(New nvSorter(-1)) '降序
list.Reverse() '反序
参考https://oomake.com/question/985897 |