我在模式中有 CSV 数据
A,B,C,D,E,F,G C,F,G,L,K,O,F a,b,c,d,e,f,g f,t,s,n,e,K,c B,F,d,e,t,m,A
我希望这些数据以以下形式存储:
A B C D B,C,D,E C,D,E,F D,E,F,G . . .
当我尝试按照以下方式进行操作时,我在中间缺少一种模式。例如:C,D,E,F
这是我的代码:
static void Main(string[] args)
{
FileStream fs = new FileStream("studentSheet.csv", FileMode.Open);
StreamReader reader = new StreamReader(fs);
List<string> subline = new List<string>();
string line = "";
while ((line = reader.ReadLine()) != null)
{
string[] splitstring = line.Split(';');
string ft = null;
int i =0;
while(i <( splitstring.Length - 3)+1)
{
ft = splitstring[i] + "," + splitstring[i+1]
+ "," + splitstring[i+2] +","+ splitstring[i+3];
subline.Add(ft);
i = i + 1;
}
}
foreach(string s in subline)
Console.WriteLine(s);
Console.ReadLine();
}