moznion / p6-Text-LTSV

LTSV formatted text parser and builder for perl6
Artistic License 2.0
0 stars 2 forks source link

Build Status

NAME

Text::LTSV - LTSV (Labeled Tab Separated Value) toolkit

SYNOPSIS

use Text::LTSV;

my $ltsv = Text::LTSV.new;

## one line
$ltsv.stringify(Array[Pair].new(
    'foo'  => 'bar',
    'buz'  => 'qux',
    'john' => 'paul',
)); # => "foo:bar\tbuz:qux\tjohn:paul"

## multiple lines
$ltsv.stringify(Array[Array[Pair]].new(
    Array[Pair].new('foo' => 'bar'),
    Array[Pair].new('buz' => 'qux'),
)); # => "foo:bar\nbuz:qux"

## With parser
use Text::LTSV::Parser;
my $parser = Text::LTSV::Parser.new;
$ltsv.stringify($parser.parse-line("foo:bar\tbuz:qux\tjohn:paul\n")); # => "foo:bar\tbuz:qux\tjohn:paul"
$ltsv.stringify($parser.parse-text("foo:bar\tbuz:qux\njohn:paul\tgeorge:ringo\n")); # => "foo:bar\tbuz:qux\njohn:paul\tgeorge:ringo"

DESCRIPTION

Text::LTSV is a builder for LTSV (Labeled Tab Separated Values).

METHODS

multi method stringify(Pair @key-values) returns Str

Stringify LTSV as one line.

multi method stringify(Array[Pair] @multi-key-values) returns Str

Stringify LTSV as multiple lines. You can specify new line character by $.nl. Default $.nl is "\n";

SEE ALSO

AUTHOR

moznion moznion@gmail.com

COPYRIGHT AND LICENSE

Copyright 2015 moznion

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.