Skip to content

A console app that allows you to perform a search within a comma-separated values (CSV) file.

License

Notifications You must be signed in to change notification settings

fabriziobagala/csvparser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CsvParser

A console app that allows you to perform a search within a comma-separated values (CSV) file.

Prerequisites

To start the solution, it must be installed in your machine:

Third-Party Libraries

I used the following Nuget packages:

  • CsvHelper is a .NET library for reading and writing CSV files.
  • Castle Windsor is a mature Inversion of Control container available for .NET.

Get Started

The application receives as command line arguments the path to a CSV file to import, a column number to search in and a keyword. It is invoked as follows:

$ CsvParser.exe ./file.csv 2 Alberto

The CSV file is formatted as in the example below:

1,Rossi,Fabio,01/06/1990
2,Gialli,Alessandro,02/07/1989
3,Verdi,Alberto,03/08/1987
4,Rossi,Giacomo,12/03/1994

Taking into consideration the arguments passed to the application with the data in the example, the following output will be produced:

3,Verdi,Alberto,03/08/1987

Before starting the search operation, it checks are carried out on the number of arguments entered and on the arguments themselves. For example, it checks that the specified file exists.

The search is case insensitive, so searching for "Alberto" or "alBertO" in column number 2 will produce the same result. Separate discussion for the ID and date of birth which must be written correctly in order to be found.

In case of equal values, the application will return the first result found.

License

Licensed under the MIT license.

About

A console app that allows you to perform a search within a comma-separated values (CSV) file.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages