我试图读取输入文件到数组中。我的文件看起来像:C#读取文件解析到数组
00000 * * M010165767HAZZ JONES FAKE乙M12 /十九万六千九百零一分之十六/ 06/2014000000036209 00000 * * M0201657677315 FAKE ST MOON TX56464 485942934维持性
当第一行的第一个单词中的模式与第二行的第二个模块中的模式相匹配时,我希望将整个被空格分隔的行压入数组或对象中。
因此我的数组将包含类似于 [5071177] - > array([Jones,Fake,B,M12/16/196901,Fake ST,Moon等]); 完成此操作的最佳方法是什么?
StreamReader sR = new StreamReader("Desktop/records2.txt");
StreamWriter sW = new StreamWriter("Desktop/new.txt");
while (sR.Peek() != -1) // stops when it reachs the end of the file
{
string line = sR.ReadLine();
// var myArray = line.Split('\n');
string[] myarray = line.Split(' ');
// "line" EDITING GOES HERE
sW.WriteLine(myarray);/
}
分上的空间,做你的逻辑是什么? ... 问题是什么? – Noctis
问题不明确。 – Carra