You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
val parsed = csv.decodeFromString(ListSerializer(Person.serializer()), input)
66
65
println(parsed)
67
66
// [
@@ -70,26 +69,25 @@ fun main() {
70
69
// ]
71
70
}
72
71
```
73
-
74
72
### Pre-defined CSV formats
75
-
The library comes with multiple pre-defined formats that can be used out of the box.
73
+
The library comes with multiple pre-defined Csv formats that can be used out of the box.
76
74
77
75
| Config | Description |
78
76
|--- |--- |
79
-
|`default`| Standard Comma Separated Value format, as for `rfc4180` but allowing empty lines. *Format is unstable and may change in upcoming versions.*|
80
-
|`rfc4180`| Comma separated format as defined by [RFC 4180](http://tools.ietf.org/html/rfc4180). |
81
-
|`excel`| Excel file format (using a comma as the value delimiter). |
77
+
|`Csv.Default`| Standard Comma Separated Value format, as for `Rfc4180` but using Unix newline (`\n`) as record separator and ignoring empty lines. *Format is unstable and may change in upcoming versions.*|
78
+
|`Csv.Rfc4180`| Comma separated format as defined by [RFC 4180](http://tools.ietf.org/html/rfc4180). |
82
79
83
80
### Configuration
84
-
CSV serialization and parsing options can be changed by providing a custom `CsvConfiguration`.
81
+
CSV serialization and parsing options can be changed by configuring the `Csv` instance during
82
+
initialization via the `Csv { }` builder function.
85
83
86
84
| Option | Default Value | Description |
87
85
|--- |--- | --- |
88
86
|`delimiter`|`,`| The delimiter character between columns. |
89
-
|`recordSeparator`|`\r\n`| The record separator. |
87
+
|`recordSeparator`|`\n`| The record separator. |
90
88
|`quoteChar`|`"`| The quote character used to quote column values. |
91
89
|`quoteMode`|`MINIMAL`| The quote mode used to decide if a column value should get quoted.<ul><li>`ALL`: Quotes *all* fields.</li><li>`ALL_NON_NULL`: Quotes all *non-null fields* and *fields which contain special characters*.</li><li>`ALL_NON_NUMERIC`: Quotes all *non-numeric fields* and *fields which contain special characters*.</li><li>`MINIMAL`: Quotes *fields which contain special characters*.</li><li>`NONE`: *Never* quotes fields (requires `CsvConfiguration.escapeChar` to be set).</li></ul> |
92
-
|`escapeChar`|`null`(`\\` for `QuoteMode.NONE`)| The escape character used to escape reserved characters in a column value. |
90
+
|`escapeChar`|`null`| The escape character used to escape reserved characters in a column value. |
93
91
|`nullString`|*empty string*| The value to identify `null` values. |
94
92
|`ignoreEmptyLines`|`true`| Ignore empty lines during parsing. |
95
93
|`hasHeaderRecord`|`false`| First line is header record. |
0 commit comments