csv
Converts a flow of objects into a flow of CSV strings, using reflection to automatically map object fields to CSV columns.
Return
A flow of CSV strings.
Example usage:
data class Person(val name: String, val age: Int)
val peopleFlow = flowOf(Person("Alice", 30), Person("Bob", 25))
peopleFlow
.csv(appendHeader = true, delimiter = ";")
.collect { line -> println(line) }
Content copied to clipboard
Parameters
appendHeader
Whether to append the header row to the CSV output. Defaults to true.
delimiter
The delimiter to use for separating values in the CSV. Defaults to ";".