fare-csv

API Reference

fare-csv

Robust CSV parser and printer

FARE-CSV

  • Variable +CR+
    "
    "
    String containing a CR (Carriage Return)
  • Variable +LF+
    "
    "
    String containing a LF (Linefeed)
  • Variable +CRLF+
    "
    "
    String containing a CRLF line termination
  • Variable *SEPARATOR*
    #\,
    Separator between CSV fields
  • Variable *QUOTE*
    #\"
    delimiter of string data; pascal-like quoted as double itself in a string.
  • Variable *UNQUOTED-QUOTEQUOTE*
    nil
    does a pair of quotes represent a quote outside of quotes? M$, RFC says NIL, csv.3tcl says T
  • Variable *LOOSE-QUOTE*
    nil
    can quotes appear anywhere in a field?
  • Variable *ALLOW-BINARY*
    t
    do we accept non-ascii data?
  • Variable *KEEP-META-INFO*
    nil
    when parsing, include meta information?
  • Variable *EOL*
    fare-csv:+crlf+
    line ending when exporting CSV
  • Variable *LINE-ENDINGS*
    (list fare-csv:+cr+ fare-csv:+lf+ fare-csv:+crlf+)
    acceptable line endings when importing CSV
  • Variable *SKIP-WHITESPACE*
    t
    shall we skip unquoted whitespace around separators?
  • Macro WITH-CREATIVYST-CSV-SYNTAX ((&optional) &body body)
    bind CSV syntax parameters to the CREATIVYST standard around evaluation of BODY
  • Macro WITH-RFC4180-CSV-SYNTAX ((&optional) &body body)
    bind CSV syntax parameters to the RFC 4180 standard around evaluation of BODY
  • Macro WITH-STRICT-RFC4180-CSV-SYNTAX ((&optional) &body body)
    bind CSV syntax parameters to the strict RFC 4180 standard around evaluation of BODY, forcing CRLF as line ending and disallowing binary data amongst values
  • Function READ-CSV-LINE (stream)
    Read one line from STREAM in CSV format, using the current syntax parameters. Return a list of strings, one for each field in the line. Entries are read as strings; it is up to you to interpret the strings as whatever you want.
  • Function READ-CSV-STREAM (stream)
    Read lines from STREAM in CSV format, using the current syntax parameters. Return a list of list of strings, one entry for each line, that contains one entry for each field. Entries are read as strings; it is up to you to interpret the strings as whatever you want.
  • Function READ-CSV-FILE (pathname &rest keys &key element-type external-format)
    Open the file designated by PATHNAME, using the provided keys if any, and call READ-CSV-STREAM on it.
  • Function WRITE-CSV-LINES (lines stream)
    Given a list of LINES, each of them a list of fields, and a STREAM, format those lines as CSV according to the current syntax parameters.
  • Function WRITE-CSV-LINE (fields stream)
    Format one line of FIELDS to STREAM in CSV format, using the current syntax parameters.