Skip to content

Allow empty items #143

@OutOfTouch

Description

@OutOfTouch

Hi,

Great clean library that works except for one flaw, the option to remove white space needs to be optional so that empty values between delimiters match up to the headers, without that it is impossible to know which data value goes with which header column, assuming the first line in csv file is the header column names.

The line to remove the white space in this method should be made optional with a bool parameter.

private static ICollection<string> ProcessLine(string original_line, string? separator)
     {
         List<string> wordsInLine = original_line
             .Split(separator?.ToCharArray())
             .Select(str => str.Trim()).ToList();

         wordsInLine.RemoveAll(string.IsNullOrWhiteSpace);   // Probably not needed, but just in case

         return wordsInLine;
     }

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions