Crate csv_tools

source ·
Expand description

§CSV Tools

This crate is a collection of utilities to make reading, manipulating and creating CSV files easier. You can open a CSV file, read the text in it and find text, define a delimiter, change it and save the file with the new delimiter, merge CSV files, map the rows with a custom data structure, etc.

Note that quotes are supported with this crate. Meaning that if a cell is surrounded by double quotes, it will count as one unique value instead of multiple values if it were to contain the delimiter.

For example, assuming the delimiter is a comma:

name,pseudo,age
Thomas,"The Svelter",20
Yoshiip,"The best, and only, Godoter",99

The second row contains 3 values. However, without the quotes it would have been parsed as 5 different values: "Yoshiip", "The best", " and only", " Godoter", 99 since it contains the delimiter.

By default, a row without double quotes will be parsed using a simple built-in method (split), which is slightly more performant since less calculations are needed to find and locate the right ending of a string.

Escape characters are allowed, meaning that a string can contain \".

Structs§

  • A simple data structure for identifying the position of a cell within a CSV file.
  • A simple data structure for holding the raw string data of a CSV file.