Click here to Skip to main content
13,258,055 members (48,173 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


1 bookmarked
Posted 7 Oct 2010

A small CSV Splitter in C#

Rate this:
Please Sign up or sign in to vote.
Gives splitted values taking csv string as input.
public string[] SplitCSVString(string csvString)
            // CSV Reg Ex: ",(?!(?<=(?:^|,)\s*\x22(?:[^\x22]|\x22\x22|\\x22)*,)(?:[^\x22]|\x22\x22|\\x22)*\x22\s*(?:,|$))"
            string strPattern = ",(?!(?<=(?:^|,)\\s*\\x22(?:[^\\x22]|\\x22\\x22|\\\\x22)*,)(?:[^\\x22]|\\x22\\x22|\\\\x22)*\\x22\\s*(?:,|$))";
            System.Text.RegularExpressions.Regex csvSplitter = new System.Text.RegularExpressions.Regex(strPattern);
            return csvSplitter.Split(csvString);


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Mahendra Kumar Srivastava
Team Leader M*Modal
India India
Started carreer with CEERI, Delhi, India as a C Programmer in 2004 and migrated my learning experiance to C#.Net in 2005 with DIGISIGN Noida, Joined Bally in 2006, worked with JK Technosoft since Jun 2007 till Apr 2009, joined back Bally in June 2009 and joined Misys in June 2010. Worked in different domains such as Casino Management, Digital Signage, and Medical and currently working M*Modal as Lead - Product Development.

You may also be interested in...

Comments and Discussions

GeneralReason for my vote of 1 no description Pin
mstr89911-Oct-10 3:15
membermstr89911-Oct-10 3:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.171114.1 | Last Updated 7 Oct 2010
Article Copyright 2010 by Mahendra Kumar Srivastava
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid