提取文本文件的一部分以在vb.net中使用 [英] Extract part of a text file for usage in vb.net
问题描述
好的。我需要将一些记录存储在 data.dat
文件中。
文件中的记录按日期值排序。每个记录块均以其日期值开头,并带有 $
符号,以指示新的记录块从此处开始,并以#符号结束,以指示记录的结束。记录块。
Ok. I need to store some records in a file namely data.dat
.
Records in the file are sorted by date values. Each block of record starts with its date value along with a $
sign to indicate that a new block of record starts here and ends with a "#" sign to indicate end of the record block.
记录块的示例为:
$22/08/2013
(data)
(data)
(data)
#
文件data.dat包含多个这样的块,如何使用vb.net提取文件中的每个块并将每个块存储在数组中?
The file data.dat contains several blocks like this, how can I extract each block in the file storing each in an array using vb.net?
推荐答案
在我看来,Tuple四重奏已准备就绪。
It looks to me a Tuple quartet would be ready made for this.
Dim Record As New List(Of Tuple(Of DateTime, String, String, Integer))
然后可以通过项目编号访问每个字段:
Then each field can be accessed by it's item number:
Record(0).Item1
这篇关于提取文本文件的一部分以在vb.net中使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!