我想只在它以特定字符开头时读取行

时间:2016-10-26 17:10:28

标签: .net vb.net io

我有一个文本文件,如下所示

O "ABC123.GEO"
O "A83.GEO"
O "A765.GEO"
@ "A38456.geo"
@ "RX34.geo"
1 entries Of @ "A756473.geo" added In New data

我想只读取以@

开头的行

我这样做是VB.NET

1 个答案:

答案 0 :(得分:0)

Dim str as string = ""
Using sr as new io.streamReader(path)
  While sr.Peek <> -1
  Str = sr.Readline()
    If str.startswith("@")   
      ' Do action
    End if
  END While
End Using