数组输出求助
原文本:58724 2001 04 60,80,17,
58724 2001 04 60,80,17,
58724 2001 04 60,
58724 2001 04 80,60,
58724 2001 04 01,10,60,
58724 2001 04 60,10,
58724 2001 04 15,17,80,60,
代码:
Private Sub Command1_Click()
Dim s As String
Dim flag As Integer
flag = 0
myfile1 = App.Path & "\" & "天气日数4.txt"
myfile2 = App.Path & "\" & "天气日数8.txt"
Open myfile1 For Input As #1
Open myfile2 For Output As #2
'Print #2, ; Spc(2); "站名"; Spc(2); "年"; Spc(2); "月"; Spc(2); "风速"; Spc(2); "风向"
Do While Not EOF(1)
Line Input #1, s
Dim arr
While InStr(s, ";")
s = Replace(s, ";", ",")
Wend
arr = Split(s, ",")
For i = LBound(arr) To UBound(arr)
Print #2, arr(i)
Next i
'flag = flag + 1
Loop
Close #2
Close #1
End Sub
Private Sub Command2_Click()
代码得到的结果:
58724 2001 04 (60
80
17
58724 2001 04 (60
80
17
58724 2001 04 (60
58724 2001 04 (80
60
58724 2001 04 (01
而本人想要的结果:
58724 2001 04 60
58724 2001 04 80 60
58724 2001 04 01 10 60
58724 2001 04 60 10
58724 2001 04 15 17 80 60
58724 2001 04 01
58724 2001 04 80 17
请问如何修改代码中的红色部分,才能实现我想要的结果,给5-10分