我在每个结尾处都有一长串三个字# 都存储在文本文件中 如何打印直到# 在文件中:Jorj#bush#123456#美国总统# 我想要一样的话:
Dim details() As String = IO.File.ReadAllLines(filename)
Dim query = From line In details
Let fullname = line.Split("#"C)(0)
Let family_name = line.Split("#"c)(1)
Let phone_number = line.Split("#"c)(2)
Let comment = line.Split("#"c)(3)
Select fullname, family_name, phone_number, comment
答案 0 :(得分:2)
这应该按预期工作。但你可以提高效率:
Dim query = From line In details
Let parts = line.Split("#"c)
Let fullname = parts(0)
Let family_name = parts(1)
Let phone_number = parts(2)
Let comment = parts(3)
Select fullname, family_name, phone_number, comment
否则你将每行分成4次。