如何在asp.net中读取csvfile时处理逗号 [英] How to deal with comma while reading csvfile in asp.net

查看:114
本文介绍了如何在asp.net中读取csvfile时处理逗号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





 使用(System.IO.StreamReader file =  new  System.IO.StreamReader(Server.MapPath(filepath)))
{
while ((line = file.ReadLine())!= null
{
string [] rec = line.Split(' ,');
if (rec.Length == 25
{

}





如果,其中一些列有逗号,那么rec.length就会消失...而我由于condion没有开会,我无法正常阅读..



请建议

解决方案

而不是重新发明轮子,尝试使用现有的库来使您的工作更轻松。



以下所有内容均为免费和开源:


Hi ,

using (System.IO.StreamReader file = new System.IO.StreamReader(Server.MapPath(filepath)))
                        {
                            while ((line = file.ReadLine()) != null)
                            {
                                string[] rec = line.Split(',');
                                if (rec.Length == 25)
                                {

}



if , some of the columns has got comma there , then rec.length is excceding ... and i am not able to read properly as condion is not meeting ..

Please suggest

解决方案

Rather than re-inventing the wheel, try using an existing library to make your job easier.

All of the following are free and open-source:


这篇关于如何在asp.net中读取csvfile时处理逗号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆