>
KenL.Net  A Developer's Expedition






Skip Navigation Links
Home
Skip Navigation Links
Architecture
Skip Navigation Links
Windows
Skip Navigation Links
Web
Skip Navigation Links
Sharepoint
Skip Navigation Links
Data Development

Data Development

Split CSV to String Array

 
protected virtual string[] SplitCSV(string line)
      {         System.Text.RegularExpressions.RegexOptions options = ((System.Text.RegularExpressions.RegexOptions.IgnorePatternWhitespace | System.Text.RegularExpressions.RegexOptions.Multiline)
            | System.Text.RegularExpressions.RegexOptions.IgnoreCase);
         Regex reg = new Regex("(?:^|,)(\\\"(?:[^\\\"]+|\\\"\\\")*\\\"|[^,]*)", options);
         MatchCollection coll = reg.Matches(line);
         string[] items = new string[coll.Count];
         int i = 0;
         foreach(Match m in coll)
         {
            items[i++] = m.Groups[0].Value.Trim('"').Trim(',').Trim('"').Trim();
         }
         return items;
      }




More Recent Data Development Articles:

Select XML Nodes by Attribute Value
Get all name nodes use XPath expression /Names/Name. To get only male names (to select all nodes with specific XML attribute) use XPath expression /Names/Name[@type='M'].

Select Top XML Nodes using XPath
This example shows how to select Top N nodes of the specific name from an XML document.

Deserialize XML object
Example on how to Deserialize and XML object into a Class/Object

Search for text with in stored procs of a db
Use these handle statements to search for text within all your stored procs

Update XML within a table
Example on how to update a portion of XML within a table

TSQL Try Catch Block
How to use Begin Try Begin Catch in TSQL

TSQL ROW_NUMBER()
How to use TSQL ROW_NUMBER() function

Read Connection String From DLL.config file
Example on how to read from a DLL's App Config - useful when using class library and you want the library to have its own app.config

Read Connection String From DLL.config file
Example on how to read from a DLL's App Config - useful when using class library and you want the library to have its own app.config

IBM DB2 .Net Provider
Extracting Data from an iSeries is simple using IBM's .Net data provider

SQL 2005 Schema change auditing
An example of SQL 2005 Schema change auditing

Stored Procedure to DataSet
The beloved dataset. Here is an example on how to create and use them.

Exporting a datagrid object's data to Excel
Example on how to send data to Excel

Creating a dataset is simple
Example on how to create and use DataSets

SQL Connection String
How to use SQL connections strings with both Web Applications and Windows Applications

SQL statements that return particular date strings
T-SQL Date Format statements

Excel as a database - ADO.Net
Utilized Excel's OleDB provider to work like SQL

DataGridView - Binding and Filter
DataGridView - Binding and Filter

WCF with LINQ
Utilze LINQ while working with WCF. This is a good example of using the 3.5 framework



KenL.Net - Home Page of Ken Lovely, MCSE, MCDBA free source code, .NET Development, .NET technology, .NET platform, .NET, Windows Longhorn, longhorn programming, aero, avalon, Indigo, Longhorn, WinFS, WinFX, XAML,Longhorn SDK, C#, C#.NET, C# .NET, CSharp, Windows Longhorn, Whidbey, Visual Studio .NET, XAML, Avalon, Aero, WinFS, WinFX, Avalon, dot net, dotnet, .net, csharp, c sharp, c, sharp, c-sharp, C#, dotnet, VC#, Visual C#, .NET, ASP, ASP+, CSharp, C-Sharp, VB.NET, XML, SOAP, dot net jobs, contracts, books, downloads, software, Java, J#, Visual J#, JSharp, j-sharp, cobol, cobol.net, cobol dot net, speech.net, speech, mobile programming, threading, security, .net security, xml.net, printing, training, dot net training, Tutorials, Articles, Programming, web forms, windows forms, ASP.NET, Web services, XML Web services, Visual studio .net, VC++.NET, managed extensions in C++, MFC, ATL, COM, COM+, DCOM, Pocket PC, Embedded& developement, JScript .NET, VBScript .NET, Mono Project, Eiffel .NET, Windows CE .NET, Magazines, ADO.NET, Cryptography, Active Directory, DirectX, Exception Handling, GDI+, GDI, Strings, Arrays, C# Language, Applied .NET, ken lovely, mcse, mcad, mcsd, mcdba