Just simple C# implementation of LTSV (Labeled Tab-separated Values).
C# Shell Perl Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LTSV
UnitTestLTSV
.gitignore
LISENCE
LTSV.sln
README.md
Rakefile

README.md

LTSV.NET

Just simple C# (.NET) implementation for LTSV (Labeled Tab-separated Values).

Install

Install from NuGet (NuGet Gallery | LTSV.NET).

PM> Install-Package LTSV

Usage

Using namespace.

using LTSV;

Parse an LTSV record.

Ltsv.ParseLine("time:28/Feb/2013:12:00:00 +0900\thost:192.168.0.1\treq:GET /list HTTP/1.1\tstatus:200\n");
// => new Dictionary<string, string>
//    {
//        { "time", "28/Feb/2013:12:00:00 +0900" },
//        { "host", "192.168.0.1" },
//        { "req", "GET /list HTTP/1.1" },
//        { "status", "200" }
//    };

Build an LTSV record.

Ltsv.BuildLine(new Dictionary<string, string>
    {
        { "time", "28/Feb/2013:12:00:00 +0900" },
        { "host", "192.168.0.1" },
        { "req", "GET /list HTTP/1.1" },
        { "status", "200" }
    });
// => "time:28/Feb/2013:12:00:00 +0900\thost:192.168.0.1\treq:GET /list HTTP/1.1\tstatus:200"

Parse LTSV.

var ltsvStr = "hunter:sAccan\tmOmonga:10\nhunter:lotus_gate\tmOmonga:1e6";
new Ltsv(ltsvStr).Records;
new Ltsv().Parse(ltsvStr).Records;

Build LTSV.

var ltsv = new Ltsv("hunter:sAccan\tmOmonga:10\nhunter:lotus_gate\tmOmonga:1e6");
Console.WriteLine(ltsv.ToString());

License

(Public Domain)2013 ne_Sachirou <utakata.c4se@gmail.com>