16,721
社区成员




var line = "CHORD WIDppppppppppp 374.613 373.047 1.566";
var value = double.Parse(line.Substring(20, 10));
表示从第21个字符开始,10个字符是 value。
这里是位置协议,不是什么分割。你在编程之前要先能够理解数据表示协议,而不要盲目胡乱解释!Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sr As New System.IO.StreamReader("Z:\test.txt")
Dim reg As New System.Text.RegularExpressions.Regex("^([A-Za-z' ]+)(.*)$")
Dim i As Integer = 0
While Not sr.EndOfStream
Dim strLine As String = sr.ReadLine()
i += 1
With reg.Matches(strLine)
If .Count = 0 Then
Debug.Print(String.Format("第{0}行:不可分|{1}", i, strLine))
Else
Debug.Print(String.Format("第{0}行:{1}|{2}", i, .Item(0).Groups(1).Value.Trim(), .Item(0).Groups(2).Value))
End If
End With
End While
End Sub
End Class