【发布时间】:2012-05-30 07:46:57
【问题描述】:
我需要一个关于如何读取引号之间的文本文件数据的“想法”。例如:
line 1: "read a title"
line 2: "read a descr"
line 1: "read a title"
line 2: "read a descr"
我想做一个 foreach 类型的事情,我想读取所有第 1 行和第 2 行作为一对,但在“。”之间。
在我的程序中,我将输出(当然是 foreach):
readTerminatedNull(file1);
readTerminatedNull(file2);
我会逐行阅读,但有些文字可能是:
line 1: "read a super long
title that goes off"
line 2: "read a descr"
这就是为什么我想在“。”之间阅读。
对不起,如果这太复杂了,而且有点难以解释。
编辑: 感谢所有反馈的家伙,但我不确定你是否得到了我想要做的事情:p 不是你的错,我写的这个有点奇怪。
我将有一个充满引用和文本的文本文件。像这样。
里面的文字:
Refren: "myrefrence_1"
String: "This is a string of a refrence"
Refren: "myrefrence_2"
String: "hello world"
Refren: "myrefrence_3"
String: "I like cookies."
我希望它在第一行的引号中读取 myrefrence_1,然后在 ".
之间读取下一行中的字符串然后,我将在我的程序中填充与字符串匹配的引用。
但有时文本会超过一行。
Refren: "this is text that goes and then
return keys on some parts."
我仍然希望它通读“。
【问题讨论】: