Daff - Data Diff

daff.Csv

Read and write CSV format. You don’t need to use this to use daff! Feel free to use your own.

Type: class

Constructor:

new(?delim : String, ?eol : String)

Parameters: delim cell delimiter to use, defaults to a comma

Methods:

getDiscoveredEol () : String
  Return the EOL sequence discovered the last time
  a CSV file/string was parsed.

Returns: one of “\n”, “\r”, “\n\r”, “\r\n”, null

makeTable (txt : String) : Table
  Create a table from a string in CSV format.

Parameters: txt the table encoded as a CSV-format string

Returns: the decoded table

parseCell (txt : String) : String
  Parse a string in CSV format representing a cell.

Parameters: txt the cell encoded as a CSV-format string

Returns: the decoded content of the cell

parseTable (txt : String, tab : Table) : Bool
  Parse a string in CSV format representing a table.

Parameters:

  • txt the table encoded as a CSV-format string
  • tab the table to store cells in

Returns: true on success

renderCell (v : View, d : Dynamic, ?force_quote : Bool) : String
  Render a single cell in CSV format.

Parameters:

  • v a helper for interpreting the cell content
  • d the cell content
  • force_quote set if cell should always be quoted

Returns: the cell in text format, quoted in a CSV-y way

renderTable (t : Table) : String
  Convert a table to a string in CSV format.

Parameters: t the table to render

Returns: the table as a string in CSV format

setPreferredEol (eol : String) : Void
  Set the EOL sequence to use at end of rows.
  a CSV file/string was parsed.

Parameters: eol “\n” or “\r\n” - if it is something else I don’t want to know.