Comments (7)
Should do. That's actually part of the reason this bug occurred. These headers sometimes have varying numbers of spaces:
"Field with
multiple lines" ,"Another field
with some
line breaks inside" , "Include some comma, for test, and some [""] Quotes" , "Normal field here"
That whole sample file parses without issue now.
Also worth noting that all strings parsed from the CSV are trimmed in this function, so that " some field here "
is stored as some field here
:
Private Function UnquoteString(ByRef element As String) As String
Dim localElement As String
localElement = Trim$(element)
If Asc(Left$(localElement, 1)) = 34 And Asc(Right$(localElement, 1)) = 34 Then
'trim string delimiters
localElement = Mid$(localElement, 2, Len(localElement) - 2)
End If
UnquoteString = Trim$(localElement)
End Function
from vba-better-array.
Just tested this as a CSV:
"Field with
multiple lines" ,"Another field
with some
line breaks inside " , "Include some comma, for test, and some [""] Quotes" , "Normal field here"
1, 2, 3 ,4
Field 1, Field 2 , Field 3 , Field 4
and I get this as the output:
Field with multiple lines | Another field with some line breaks inside | Include some comma, for test, and some [""] Quotes | Normal field here |
---|---|---|---|
1 | 2 | 3 | 4 |
Field 1 | Field 2 | Field 3 | Field 4 |
So yes is the answer
from vba-better-array.
Thanks for your answer! I have successfully updated benchmark on a local branch. In the next few days I'll put in online and alert to you. So, delayed by an unexpected errors fixes, I hope the code be available to the community very soon.
from vba-better-array.
Hey! Thank you so much for letting me know about this!
It was a simple off-by-one error as far as I can tell - the above commit solves the issue by changing:
j = j + 1
cursor = j + 1
To:
cursor = j + 2
from vba-better-array.
I'd be very grateful if you could retest on your end if you find the time (release 1.6.1). Of course, if there are still problems I will happily reopen this issue.
from vba-better-array.
I also just fixed an issue where string in CSV weren't getting unquoted correctly in v1.6.2 just now, so that's the latest release
from vba-better-array.
Only a question, before do anything, can your parser handle an variable number of trailing spaces? i.e. A secuence like Space(2) & "," & Space(1)
or Space(4) & ","
and en of a record.
from vba-better-array.
Related Issues (20)
- Bug in Method "FromCSV" HOT 1
- How to copyFromDictionary? HOT 3
- 2d Array , add columns or join new array HOT 1
- [BUG] Doc. page ArrayType Get Accessor does not link back to ArrayType Overview HOT 1
- [BUG] Doc. page ArrayType Let Accessor does not link to Items setter page
- Last item Shift gives Length 1 HOT 1
- Handle multiarea ranges with FromExcelRange HOT 1
- Remove method it doesn't remove the only element of a 1 length array HOT 2
- Sorting in reverse, #9 review HOT 4
- Filter 2d arrays HOT 5
- Performance Issue HOT 24
- Add iterable support HOT 5
- Unexpected result on the "Splice" method
- Bug HOT 1
- Docs mistake HOT 1
- Out of string memory error [170+ MB CSV] HOT 7
- [BUG] Empty items after Concat HOT 1
- MultidimensionalArray Push HOT 1
- can betterarray sort descending? 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 vba-better-array.