strings
String/CSV utilities.
org.hammerlab.strings.TruncatedToString
Interface for classes that can render themselves as an Iterator[String]
, exposing a .toString()
that will be truncated to a maximum number of characters.
org.hammerlab.csv
:
Convert collections of case class
es (really Product
s) to CSV rows:
scala> import org.hammerlab.csv._
scala> case class Foo(num: Int, str: String)
scala> Seq(Foo(123, "abc"), Foo(456, "xyz")).toCSV()
res5: Iterator[String] = non-empty iterator
scala> Seq(Foo(123, "abc"), Foo(456, "xyz")).toCSV().mkString("\n")
res6: String =
num,str
123,abc
456,xyz
See the tests for more examples, including how to convert non-case-classes.