string[] strs = File.ReadAllLines("电话.txt",Encoding.Default );
for (int i = 0; i < strs.Length; i++)
{
string[] parts=strs.Replace ("\"","").Split(',');
Console.WriteLine("姓名:{0} 电话:{1}",parts[0]+parts[1],parts[2]);
}
Console.ReadKey();
其中 电话.txt 中的内容是:
"张","三","15011111111";
"李","四","15011111112";
"王","五","15011111113";
"赵","六","15011111114“
出现错误:
file:///C:/Users/Administrator/AppData/Local/youdao/ynote/images/82703E7EC41E421E9BB17FF72B471142/1EA7341DCFCE4720A4605F9253EBEDE1.jpg
结果中本来应该显示四行数据,但却只显示了一行,还报错说是索引超出了数组界限,这是为什么????
|