LTSV Parser implementation in Scala
Add ltsv4s to libraryDependencies.
libraryDependencies += "com.github.seratch" %% "ltsv4s" % "1.0.+"
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("クリス")
sbt test
sbt ++publishSigned sonatypeBundleRelease
Copyright 2013 - Kazuhiro Sera
Apache License, Version 2.0