如何将制表符分隔的文本文件的内容加载到二维字符串列表中?
How to load the content of a tab delimited text file into a 2D list of strings?
我似乎无法弄清楚如何将制表符分隔的文本文件加载到 VB.net 中的二维字符串列表中。我在网上找到了几个解决方案,但列数是硬编码的。我的案例中的列数会发生变化。有任何想法吗?提前致谢。
这对我有用:
Dim wordsArray as New List(Of List(Of String))
Using sr as new io.StreamReader("filename")
While Not sr.EndOfStream
wordsArray.Add(sr.ReadLine.Trim().Split(CChar(vbTab)).ToList)
End While
End Using
我似乎无法弄清楚如何将制表符分隔的文本文件加载到 VB.net 中的二维字符串列表中。我在网上找到了几个解决方案,但列数是硬编码的。我的案例中的列数会发生变化。有任何想法吗?提前致谢。
这对我有用:
Dim wordsArray as New List(Of List(Of String))
Using sr as new io.StreamReader("filename")
While Not sr.EndOfStream
wordsArray.Add(sr.ReadLine.Trim().Split(CChar(vbTab)).ToList)
End While
End Using