Module z_csv_parser

Parse CSV file into a nested list of lines and fields.

Authors: Arjan Scherpenisse (arjan@scherpenisse.net).

Description

Parse CSV file into a nested list of lines and fields.

Data Types

line()

line() = [binary()]

lines()

lines() = [line()]

sep()

sep() = 44 | 59 | 9

Function Index

cleanup_field/1
inspect_data/1Check if the first row is made up of column headers.
inspect_file/1
parse_line/2Parse a line into its columns, using a character a separator.
scan_lines/1Scan the file (or device) and return lines with fields.
scan_lines/2Scan the file (or device) and return lines with fields.

Function Details

cleanup_field/1

cleanup_field(L) -> any()

inspect_data/1

inspect_data(B0::binary()) -> {ok, line(), sep()} | {error, invalid_csv_file}

Check if the first row is made up of column headers. The file must have at least a name and a category column.

inspect_file/1

inspect_file(Filename::file:filename_all()) -> {ok, line(), sep()} | {error, invalid_csv_file | term()}

parse_line/2

parse_line(Line, Sep) -> any()

Parse a line into its columns, using a character a separator.

scan_lines/1

scan_lines(DeviceOrFilename::file:filename() | pid()) -> lines()

Scan the file (or device) and return lines with fields.

scan_lines/2

scan_lines(Filename::file:filename() | pid(), FieldSep::sep()) -> lines()

Scan the file (or device) and return lines with fields.


Generated by EDoc