请问各位大侠,读取数据后如何归类写入
N 24E 23
N 21
W 34
E 56
W 32
E 34
N 43
W 23
E 35
以上是数组,以下是语句,
Private Sub Command1_Click()
Dim s As String
Dim flag As Integer
myfile1 = App.Path & "\" & "2.txt"
myfile2 = App.Path & "\" & "4.txt"
Open myfile1 For Input As #1
Open myfile2 For Output As #2
Do While Not EOF(1)
Line Input #1, s
Dim arr
While InStr(s, " ")
s = Replace(s, " ", " ")
Wend
arr = Split(s, " ")
If arr(0) = "N" Then
Print #2, arr(1)
ElseIf arr(0) = "E" Then
Print #2, arr(1)
End If
flag = flag + 1
Loop
Close #1
End Sub
请问如何修改才能达到如下效果
N
24
21
43
E
23
56
34
35
[[it] 本帖最后由 菜鸟新上路 于 2008-10-14 14:47 编辑 [/it]]