Option ignore_last_delimiters
- Type:
boolean|integer
- Optional
- Default:
false
- Since: 4.15.0
- Related:
columns
,delimiter
— see Available Options
The ignore_last_delimiters
option disregard any delimiters present in the last field of the record. It requires the presence of the column
option to know how many fields are expected when it is defined as true
.
Some formats which claim to be partially compatible with csv formats assume that it's ok to have unescaped commas in the last field because the number of fields was registered when the header line was parsed.
For example, Advanced SubStation Alpha (ASS), technically SSA v4+, is a subtitle file format. You can see such behavior in its specification:
The format line specifies how SSA will interpret all following Event lines. The field names must be spelled correctly, and are as follows:
Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text. The last field will always be the Text field, so that it can contain commas.
and here:
The information fields in each line are separated by a commas.
This makes it illegal to use commas in character names and style names (SSA prevents you putting commas in these). It also makes it quite easy to load chunks of an SSA script into a spreadsheet as a CSV file, and chop out columns of information you need for another subtitling program.
Example
In this example, the CSV data is made of 2 fields, format
and description
. Fields are separated by commans, the default delimiter. The last field, description
, can contains any number of commas without breaking the record.