TsadriuUtilities.Csv 1.6.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package TsadriuUtilities.Csv --version 1.6.1                
NuGet\Install-Package TsadriuUtilities.Csv -Version 1.6.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TsadriuUtilities.Csv" Version="1.6.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TsadriuUtilities.Csv --version 1.6.1                
#r "nuget: TsadriuUtilities.Csv, 1.6.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install TsadriuUtilities.Csv as a Cake Addin
#addin nuget:?package=TsadriuUtilities.Csv&version=1.6.1

// Install TsadriuUtilities.Csv as a Cake Tool
#tool nuget:?package=TsadriuUtilities.Csv&version=1.6.1                

TsadriuUtilities.Csv

A small package that parses a CSV file.

TsadriuUtilities.Csv is a library that helps on dealing with CSV files, to make it easier and save a little bit of time.

> Features <

CsvTable:

To create a new instance, use ICsvTable table = new CsvTable(string[] csvLines, string delimiter = ";") + 7 overload;

  • CultureInfo CultureInfo { get; set; }
    • Gets or sets the culture of this table. Setting this property will apply the culture on all elements of the ColumnList.
  • string Delimiter { get; set; }
    • Gets or sets the delimiter used on the csv file.
  • List<ICsvColumn> ColumnList { get; set; }
    • Gets or sets the list of ICsvColumn of the current ICsvTable.
  • AddColumn(string columnName, int index = -1) + 1 overload:
    • Adds a new column to the ColumnList.
  • GetColumn(string columnName, StringComparison comparison):
    • Returns the column based on the name. If the column does not exist, it returns a new column with the name of UNDEFINED.
    • Supports csvTable[string columnName], [int columnIndex] variants.
  • GetColumnIndex(string columName, CsvSearchType searchType, StringComparison comparison) +1 overload:
    • Returns the index of the column.
    • Supports csvTable[string columnName, CsvSearchType searchType], csvTable[CsvSearchType searchType, StringComparison comparison, string[] columnName] variants.
  • ICsvColumn GetColumn(string columnName, StringComparison comparison):
    • Checks if the columnName exists in the ColumnList, returning the first instance found. If it doesn't exist, it return a new CsvColumn with the name UNDEFINED.
  • MoveColumn(int oldIndex, int newIndex) + 1 overload:
    • Moves the position of this column with another column.
  • MergeColumn(int firstColumnIndex, int secondColumnIndex, string separator) + 1 overload:
    • Merges a column with another column.
  • SplitColumn(int columnIndex, string separator, int newColumnIndex = -1) + 1 overload:
    • Splits a column with the separator and saves the split data into a new column.
  • RemoveColumn(int[] columnIndex) + 1 overload:
    • Removes a column from the ColumnList.
  • List<string> ToList(bool includeHeader):
    • Converts the ICsvTable into a List<string>.
  • string[] ToArray(bool includeHeader):
    • Converts the ICsvTable into an array of string.
  • string ToString(bool includeHeader, SplitType newLineType):
    • Converts the ICsvTable into a string.

CsvColumn:

→ _To create a new instance, use ICsvColumn column = new CsvColumn() + 3 overload;

  • string Name { get; set; }
    • Gets or sets the column name.
  • CultureInfo CultureInfo { get; set; }
    • Gets or sets the culture info.
  • bool ContainsEmptyRows { get; }
    • Gets a value indicating whether this column contains any empty rows or not.
  • List<string> RowList { get; set; }
    • Gets or sets the row list.
  • AddRow(string row) + 1 overload:
    • Adds a row.
  • AddToRowElements(CsvRowAddType direction, string value):
    • Adds value in the rows.
  • GetRow(int index) +1 overload:
    • Returns the row corresponding to the index. If the index is out of bounds, it returns a string.Empty.
    • Supports csvColumn[int index] variant.
  • GetRowEqual(StringComparison comparison, string value)
    • Returns the first row that contains the value.
  • GetRowOrEqual(StringComparison comparison, params string[] values)
    • Returns the first row that contains one of the values.
  • GetRowAndContains(StringComparison comparison, params string[] values)
    • Returns the first row that contains all of the values.
  • GetRowOrContains(StringComparison comparison, params string[] values)
    • Returns the first row that contains one of the values.
  • NormalizeNumbers(CultureInfo? culture):
    • Normalizes the numbers of the RowList by using the culture.
  • ChangeDateFormat(string oldDateFormat, string newDateFormat):
    • Parses the RowList with the oldDateFormat to a DateTime and converts it back to a string using the newDateFormat.

CsvHelper:

  • ReadMultipleHeaderCsv(string[] csvLines, string delimiter, int[] headerPosition) + 1 overload:
    • Helps on reading a csv that has multiple headers.
  • ToList(List<ICsvTable> tableList):
    • Converts a List of ICsvTable into a csv.
  • ToString(List<ICsvTable> tableList, bool includeHeader, SplitType newLineType):
    • Converts a List of ICsvTable into a single string.
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.7.3 522 6/15/2023
1.7.2 198 5/22/2023
1.7.1 246 4/17/2023
1.7.0 243 2/28/2023
1.6.1 412 2/21/2023
1.6.0 254 2/17/2023
1.5.4 238 2/14/2023
1.5.3 254 2/14/2023
1.5.2 250 2/14/2023
1.5.1 246 2/14/2023
1.5.0 259 2/14/2023
1.4.4 262 2/13/2023
1.4.3 265 2/13/2023
1.4.2 231 2/13/2023
1.4.1 241 2/13/2023
1.4.0 263 2/13/2023
1.3.0 283 2/10/2023
1.2.0 280 2/7/2023
1.1.1 323 1/25/2023
1.1.0 290 1/25/2023
1.0.0 284 1/24/2023

CsvTable:
- The constructor parameter (delimiter) no longer has a default value. This was made to avoid an ambiguous invocation of the constructor.