Divides a row into fields at each unquoted pipe
All 8 scenarios hold
These rules cover how one line divides into fields. They apply before the parser reads a field as a value.
Each Row below is parsed as the only data row under a one-column header. Fields shows the captured field list, printed back out. Fields is text rather than a list column because a list cannot hold a null element: writing [a, , c] is itself a parse error. A null field is what several of these rules are about.
A leading pipe, a trailing pipe, or two pipes together leave a field with no text. The parser captures that field as null.
Spacing around a pipe changes nothing. One row carries both spellings of the same three fields, in place of two rows with one expectation between them.
expected outcome
broken scenario
| Scenario | Row | Fields? |
|---|---|---|
| No pipe at all | a | [a] |
| One pipe | a | b | [a, b] |
| Spaced or unspaced pipes |
| [a, b, c] |
| A trailing pipe | a | b | | [a, b, null] |
| A leading pipe | | a | b | [null, a, b] |
| An empty field between pipes | a | | c | [a, null, c] |
| Nothing but pipes | ||| | [null, null, null, null] |