急盼答案

伊醉芳羞 2009-11-18 03:50:00
将一个以逗号为分隔符的文本文件读入以数组输出
读入
1,2,3
1,2,3
输出
1 2 3
1 2 3
...全文
139 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
xmoutyeram 2009-11-18
  • 打赏
  • 举报
回复
using (StreamReader sr=new StreamReader(path))
{
while(sr.Peek()>-1)
{
string[] str=sr.ReadLine().Split(',");
foreach(string s in str)
{
Console.Write(s+" ");
}
Console.WriteLine();
}
}
xmoutyeram 2009-11-18
  • 打赏
  • 举报
回复
streamreader读入后用split(',')分割再输出

111,097

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧