我有以下字符串列表,我想对它们进行排序,就像在Windows中“按名称排序”一样
Dim arrayInput As List(Of String) = New List(Of String)
arrayInput.Add("CE4-B1-D1.csv")
arrayInput.Add("CE4-B1-D1-1.csv")
arrayInput.Add("CE4-B1-D1-3.csv")
arrayInput.Add("CE4-B1-D1-2.csv")
arrayInput.Add("CE4-B1-D2.csv")
arrayInput.Add("CE4-B1-D2-1.csv")
arrayInput.Add("CE4-B1-D2-2.csv")
arrayInput.Add("CE4-B1-D11.csv")
arrayInput.Add("CE4-B1-D11-1.csv")
arrayInput.Add("CE4-B1-D7.csv")
如果我使用arrayInput.Sort()
,结果将是
CE4-B1-D1.csv
CE4-B1-D11.csv
CE4-B1-D1-1.csv
CE4-B1-D11-1.csv
CE4-B1-D1-2.csv
CE4-B1-D1-3.csv
CE4-B1-D2.csv
CE4-B1-D2-1.csv
CE4-B1-D2-2.csv
CE4-B1-D7.csv
但我想要的是这样的:
CE4-B1-D1.csv
CE4-B1-D1-1.csv
CE4-B1-D1-2.csv
CE4-B1-D1-3.csv
CE4-B1-D2.csv
CE4-B1-D2-1.csv
CE4-B1-D2-2.csv
CE4-B1-D7.csv
CE4-B1-D11.csv
CE4-B1-D11-1.csv