我有一個文本文件,看起來像下面的格式。我正嘗試創建一個格式不正確的數據表。我已經嘗試了一些不同的東西,以正確格式化它但是我有的ReadLine問題vb.net textfile ReadLine循環
Dim SectionLineONE as string
Dim NextSectionLine As String
srReader = File.OpenText(MyFile)
Dim SectionLineONE As String
Do
SectionLineONE = srReader.ReadLine()
If SectionLineONE Is Nothing Then Exit Do
If SectionLineONE.Contains("1.0") Then
Dim NextSectionLine As String
Do
NextSectionLine = srReader.ReadLine()
If NextSectionLine Is Nothing Then Exit Do
If NextSectionLine.Contains("1.1") Then
Dim NextSectionLine3 As String
Do
NextSectionLine3 = srReader.ReadLine()
If NextSectionLine Is Nothing Then Exit Do
If NextSectionLine.Contains("1.1.1") Then
Dim NextSectionLine4 As String
Do
NextSectionLine4 = srReader.ReadLine()
If NextSectionLine Is Nothing Then Exit Do
If NextSectionLine.Contains("1.1.1.1") Then
'I want the program to go to the first do loop now and check 2.0, 2.1 etc
End If
Loop
End If
Loop
End If
Loop
End If
Loop
Text File
1.0
Section 1 Title:
1.1
Section Title
1.1.1
Section Title
1.1.1.1
Section Title
這與[你的最後一個問題](http://stackoverflow.com/q/40897137/1070452)有什麼不同? – Plutonix
@Plutonix ...我們不能將它作爲一個dup關閉。 – LarsTech
它不同,因爲我加入了1.1.1.1。一旦程序讀取1.1.1.1我怎樣才能把它交給我的第一個循環。從不回答 – codeMonger123