Re: [VB6 ]字串轉數值的問題
利用Split函數
我會這麼做
Private Sub MacroWorkshop()
Dim tempstr As String
Dim numStr As String
Dim str As String
Dim pp As String
Dim ii As Integer
Dim anum As Double
Dim bnum As Double
Dim arr() As String
Open "E:\test\testfile.txt" For Input As #1
While Not EOF(1)
Line Input #1, tempstr
str = tempstr
Debug.Print str
arr = Split(str, " ")
For ii = 0 To 3
Debug.Print arr(ii)
Next ii
Wend
Close
End Sub
不過這方法的前提是:你的空白長度一定要是1(要一致)
不然會有問題
--
《我的Blog》http://clubtblog.blogspot.com/
你的資料如下 (這是控制碼,每個人都會看到自己的資料)
《ID暱稱》 ()
《上站次數》次
《文章篇數》篇
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.136.53.218
→
06/23 09:23, , 1F
06/23 09:23, 1F
→
06/23 10:32, , 2F
06/23 10:32, 2F
→
06/23 10:32, , 3F
06/23 10:32, 3F
→
06/23 11:48, , 4F
06/23 11:48, 4F
→
06/23 14:07, , 5F
06/23 14:07, 5F
※ 編輯: ClubT 來自: 220.136.53.218 (06/23 14:07)
討論串 (同標題文章)
完整討論串 (本文為第 3 之 3 篇):