Comments (3)
Thanks for the feedback. It does seem like it would be useful to bring some more of those configuration options over from the VB TextFieldParser. Especially since most of the functionality needed for those three options is already in there.
I added the Delimiters
, HasFieldsEnclosedInQuotes
, TrimWhiteSpace
properties. And I put out a new release that includes them: v1.1.1.
For the string[] Delimiters
property, I originally left it out because this version of the parser only supports a single, one-character delimiter. And I didn't add a char Delimiter
property because I wanted to leave the possibility open for supporting string delimiters in the future. But even without adding support for multiple string delimiters, I can at least add partial support for this property. With this new release, the string[] Delimiters
is available but it will throw a NotSupportedException
if you specify more than one delimiter or a delimiter with two or more characters in it.
I originally left out the HasFieldsEnclosedInQuotes
option because I thought there wouldn't really a reason to use this library if you don't care about the special quote handling. But the main goal of this library is to provide compatibility with the VB version, and it's a very simple change to implement, so I don't see any reason not to add it. There could even be some good cases for it where you want to conditionally support the quoting logic without having to use two completely different parsers.
I originally left out the TrimWhiteSpace
option because I thought it would be a lot of work to implement and I didn't have an immediate need for it. But it turns out that the VB parser mostly ignores whitespace even if this option is off, so most of the work was already done to support the compatibility mode. So adding this didn't actually require very much work.
from csvtextfieldparser.
For the string constructor, the problem is that the VB TextFieldParser already has a constructor that accepts a string filename, and my main goal with this library is compatibility with that parser. So this parser has that same, much less useful, filename string constructor. Otherwise I probably would have added a constructor that accepts a CSV string.
However, it would be possible to add a static factory method that accepts a string and returns a parser for it. The main reason I haven't added one is because then I have decide what to call it (Create, CreateFromString, CreateForString, CreateFromText, CreateForText, Parse, etc.). And because it would be a pretty minimal implementation (probably just new CsvTextFieldParser(new StringReader(text))
).
So I think I'll leave it out for now. But I wouldn't be completely opposed to adding a static factory method someday.
from csvtextfieldparser.
HI,
Sorry to post here, I wanted to create a new issue but it suggested this issue was relevant which it is.
Thanks for this code, I am migrating a massive project to NetStandard and this helped me get rid of the VisualBasic dependency without rewritting the garbage its doing.
It does seem though, that is default TrimWhiteSpace = true
is in the original one. I have some tests failing complaining about the whitespace issue where there are no addidiotnal paramaets passed in.
Not a major issue, luckily the Csvreader is abstracted and I can just pass that in, in one place but probably worth raising this issue.
❤️
from csvtextfieldparser.
Related Issues (14)
- Assembly signing HOT 2
- Thanks! HOT 2
- Item order in subsequent iterations? HOT 2
- This parser doesn't support multiple delimiters HOT 1
- Suggestion: Include a CsvTextFileFormatter as well? HOT 1
- Can you please add ReadLine() method? HOT 3
- No errorLine is shown when thrown MalformedException HOT 3
- Cannot parse some csv file HOT 3
- Parsing difference between VB parser and this parser HOT 1
- Feature Request: LineNumber property HOT 1
- Issue with line parsing HOT 1
- TrimWhiteSpace default value HOT 3
- Error: is too long, or a component of the specified path is too long. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from csvtextfieldparser.