Provides syntax for decoding CSV cells as values.
Provides syntax for decoding CSV cells as values.
Importing kantan.csv.ops._
will add the following methods to String
:
Provides syntax for encoding values as CSV cells.
Provides syntax for encoding values as CSV cells.
Importing kantan.csv.ops._
will add asCsvCell to any type A
such that there exists an implicit
CellDecoder[A]
in scope.
Provides syntax for decoding CSV rows as values.
Provides syntax for decoding CSV rows as values.
Importing kantan.csv.ops._
will add the following methods to Seq[String]
:
Provides syntax for encoding values as CSV rows.
Provides syntax for encoding values as CSV rows.
Importing kantan.csv.ops._
will add asCsvRow to any type A
such that there exists an implicit
RowEncoder[A]
in scope.
Provides syntax for decoding a string as a CSV row.
Provides syntax for encoding single CSV rows as a string.
Provides syntax for encoding single CSV rows as a string.
Writing a single row as a String
is a surprisingly recurrent feature request. This is how to do it:
scala> import kantan.csv.rfc scala> (1, 2, 3).writeCsvRow(rfc) res0: String = 1,2,3
Provides syntax for turning collections into CSV strings.
Provides useful syntax for types that have implicit instances of CsvSink in scope.
Provides useful syntax for types that have implicit instances of CsvSink in scope.
The most common use case is to turn a value into a CsvWriter:
val f: java.io.File = ??? f.asCsvWriter[List[Int]](',', true)
A slightly less common use case is encode an entire collection to CSV:
val f: java.io.File = ??? f.writeCsv[List[Int]](List(List(1, 2, 3), List(4, 5, 6)), ',', true)
Provides useful syntax for types that have implicit instances of CsvSource in scope.
Provides useful syntax for types that have implicit instances of CsvSource in scope.
The most common use case is to turn a value into a CsvReader:
scala> import kantan.csv._ scala> "1,2,3\n4,5,6".asCsvReader[List[Int]](rfc).toList res0: List[ReadResult[List[Int]]] = List(Right(List(1, 2, 3)), Right(List(4, 5, 6)))
A slightly less common use case is to load an entire CSV file in memory:
scala> "1,2,3\n4,5,6".readCsv[List, List[Int]](rfc) res1: List[ReadResult[List[Int]]] = List(Right(List(1, 2, 3)), Right(List(4, 5, 6)))
Unsafe versions of these methods are also available, even if usually advised against.