Sep 0.1.0-preview.4

.NET 7.0
This is a prerelease version of Sep.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Sep --version 0.1.0-preview.4
NuGet\Install-Package Sep -Version 0.1.0-preview.4
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="Sep" Version="0.1.0-preview.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Sep --version 0.1.0-preview.4
#r "nuget: Sep, 0.1.0-preview.4"
#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 Sep as a Cake Addin
#addin nuget:?package=Sep&version=0.1.0-preview.4&prerelease

// Install Sep as a Cake Tool
#tool nuget:?package=Sep&version=0.1.0-preview.4&prerelease


Modern, minimal, fast, zero allocation¹, reading and writing of separated values (csv, tsv etc.). Trimmable and AOT friendly.

¹ After creation and first few rows both for reading/parsing and writing/formatting.

var text = """

using var reader = Sep.Reader().FromText(text);  // Infers separator 'Sep' from header
using var writer = reader.Sep.Writer().ToText(); // Writer defined from reader 'Sep'
                                                 // Use .FromFile(...)/ToFile(...) for files
var idx = reader.Header.IndexOf("B");
var nms = new[] { "E", "F" };

foreach (var readRow in reader)           // Read one row at a time
    var a = readRow["A"].Span;            // Column as ReadOnlySpan<char>
    var b = readRow[idx].ToString();      // Column to string (allocates new string per call)
    var c = readRow["C"].Parse<int>();    // Parse any T : ISpanParsable<T>
    var d = readRow["D"].Parse<float>();  // Parse float/double fast via csFastFloat
    var s = readRow[nms].Parse<double>(); // Parse multiple columns as Span<T>
                                          // - Sep handles array allocation and reuse
    foreach (ref var v in s) { v *= 10; }

    using var writeRow = writer.NewRow(); // Start new row. Row written on Dispose.
    writeRow["A"].Set(a);                 // Set by ReadOnlySpan<char>
    writeRow["B"].Set(b);                 // Set by string
    writeRow["C"].Set($"{c * 2}");        // Set via InterpolatedStringHandler, no allocs
    writeRow["D"].Format(d / 2);          // Format any T : ISpanFormattable
    writeRow[nms].Format(s);              // Format multiple columns directly

var expected = """
Assert.AreEqual(expected, writer.ToString());

// Above example code is for demonstration purposes only.
// Short names and repeated constants are only for demonstration.
Product Versions
.NET net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
Compatible target framework(s)
Additional computed target framework(s)
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
0.1.0-preview.5 42 3/19/2023
0.1.0-preview.4 54 12/31/2022
0.1.0-preview.3 54 12/4/2022
0.1.0-preview.2 76 3/21/2022
0.1.0-preview.1 88 1/28/2022