更新时间:2023-01-20 10:32:43
我已经得到了我的查询结果。它像简单的像我一直使用io.file读取文件。和所有的文本被存储为一个字符串。从那以后,我分裂了分隔符。该代码如下所示
I had got the result for my query. its like simple like i had read a file using io.file. and all the text are stored into a string. After that i splitted with a seperator. The code is shown below.
using System;
using System.Collections.Generic;
using System.Text;
namespace CSV
{
class Program
{
static void Main(string[] args)
{
string csv = "user1, user2, user3,user4,user5";
string[] split = csv.Split(new char[] {',',' '});
foreach(string s in split)
{
if (s.Trim() != "")
Console.WriteLine(s);
}
Console.ReadLine();
}
}
}