Sub test()
Dim s() As String, i&, j&, imax&, temp
Open "d:\a.txt" For Input As #1
s = Split(StrConv(InputB(LOF(1), 1), vbUnicode), vbCrLf)
Close #1
Debug.Print Join(s, vbCrLf) & vbCrLf & String(50, "-")
For i = UBound(s) To 1 Step -1
imax = 0
For j = 0 To i
If Val(Trim(Mid(s(j), 42))) > Val(Trim(Mid(s(imax), 42))) Then imax = j
Next
temp = s(imax)
s(imax) = s(i)
s(i) = temp
Next
Debug.Print Join(s, vbCrLf)
End Sub
运行结果:
0
0
0
23.45519
0
0
1
30.03188
0
0
2
30.51785
0
0
3
23.06458
0
0
4
22.56246
0
0
5
20.3469
0
0
6
25.39143
0
0
7
27.0004
0
0
8
25.68157
0
0
9
28.31564
0
1
0
30.03188
0
1
1
36.60857
0
1
2
37.09455
0
1
3
29.64128
0
1
4
29.13916
0
1
5
26.9236
0
1
6
31.96813
--------------------------------------------------
0
0
5
20.3469
0
0
4
22.56246
0
0
3
23.06458
0
0
0
23.45519
0
0
6
25.39143
0
0
8
25.68157
0
1
5
26.9236
0
0
7
27.0004
0
0
9
28.31564
0
1
4
29.13916
0
1
3
29.64128
0
1
0
30.03188
0
0
1
30.03188
0
0
2
30.51785
0
1
6
31.96813
0
1
1
36.60857
0
1
2
37.09455