eduherminio / fileparser Goto Github PK
View Code? Open in Web Editor NEWC# file parser (.NET 6)
License: MIT License
C# file parser (.NET 6)
License: MIT License
Please add support for .Net Framework 4.5 or 4.8
The following test needs to be skipped since it fails in Travis CI env (no exception is thrown).
[Fact(Skip ="No exception is thrown in Linux (CI env)")]
void IOException()
{
string fileName = "Any.txt";
StreamWriter writer = new StreamWriter(fileName);
using (writer)
{
Assert.Throws<IOException>(() => FileReader.Parse(fileName));
}
}
If no way of forcing IOException in Linux is found, test would better be deleted.
Despite ending up green, git push
fails apparently due to status checks.
Tag is pushed correctly, though.
Only known workaround used in AoCHelper is disabling the Required status checks
step in repo's configuration.
How about giving admin:repo_hook
permissions to that Api Key?
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: Examples/FileParserExample/FileParserExample.csproj
modified: NugetTest/NugetTest/NugetTest.csproj
modified: src/FileParser/FileParser.csproj
no changes added to commit (use "git add" and/or "git commit -a")
[master 7b94a97] Release v1.4.3
3 files changed, 3 insertions(+), 3 deletions(-)
remote: error: GH006: Protected branch update failed for refs/heads/master.
remote: error: 8 of 8 required status checks are expected.
To https://github.com/eduherminio/FileParser
! [remote rejected] master -> master (protected branch hook declined)
error: failed to push some refs to 'https://github.com/eduherminio/FileParser'
To https://github.com/eduherminio/FileParser
* [new tag] v1.4.3 -> v1.4.3
Finishing: Commit and push version increment
WIP, sorry for any inconvenient.
Also include an overload choosing custom separator(s)
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;
}
Existing constructor:
public ParsedFile(string path, char[] existingSeparator = null, string lineSeparatorToAdd = null)
Desirable extra constructor:
public ParsedFile(string path, string existingSeparator = null, string lineSeparatorToAdd = null)
There's currently no direct way of parsing an input like this one:
+-+++++
+-*++++
-+-%
Extract<char>(ref Queue<string>)
might need to be implemented.
Since instantiating System.ComponentModel.TypeConverter
is slow due to reflection, doing it a single time in ParseArray<T>()
could improve method's performance a lot (depending on the length of the line to be parsed).
Nowadays only IParsedFile
. IParsedLine
& FileReader
are intended to be directly used.
Last one might not be exposed in the future in favour of more methods of IParsedFile
.
Explicit public API needs to be created.
User should be able to choose a decimal separator, allowing the correct parsing of raw data using that separator.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.