LTSV parser implementation in Scala
Scala
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
project
src
.gitignore
.travis.yml
README.md
build.sbt

README.md

LTSV4S

LTSV Parser implementation in Scala

Build Status Coverage Status Maven Central

What's LTSV?

http://ltsv.org/

Usage

sbt settings

Add ltsv4s to libraryDependencies.

// if you want to use latest version
// resolvers += "sonatype releases" at "http://oss.sonatype.org/content/repositories/releases"

libraryDependencies += "com.github.seratch" %% "ltsv4s" % "1.0.+"

Example

import com.github.seratch.ltsv4s._

val log: Map[String, String] = LTSV.parseLine("field1:value1\tfield2:value2")
val line: String = LTSV.dump(log)

val logs: List[Map[String, String]] = LTSV.parseLines("field1:value1\tfield2:value2\nfield1:value1\tfield2:value2")
val lines: List[String] = LTSV.dump(logs)

In lenient mode, the parser will allow any character in a field value, apart from tab and newline chars.

val ltsv: Map[String, String] = LTSV.parseLine("name:クリス\tage:28", lenient=true)
ltsv.size should equal(2)
ltsv("name") should equal("クリス")

License

Copyright 2013 - 2015 Kazuhiro Sera

Apache License, Version 2.0

http://www.apache.org/licenses/LICENSE-2.0.html