Comments (2)
As you know from #9, this project does not yet have a csv writer. I'll work on this soon, once I find the time.
As for the reader, are you asking how to get the contents of specific cells?
Some clarifications:
- The CSV reader does not support random access, e.g.,
my_csv[14][3]
. This is a consequence of the implementation - The reader does not perform any string copies during the parsing. The reader simply saves start and end indices for cell contents - something that can be used by an iterator when it iterates over the cells in each row. - You can iterate over the cells and construct your own
std::vector<std::map<std::string, std::string>>
for all the rows in the table.
Iteration looks like below. Use .read_value()
to read the value of the cell - This involves a string copy.
for (const auto row: csv) {
for (const auto cell: row) {
// Do something with cell value
std::string value;
cell.read_value(value);
// Now you have the cell value
// You can insert this into an std::map or std::vector for use later (including operator[] access)
}
}
from csv2.
Thank you so much for your answer.
from csv2.
Related Issues (20)
- qt types compatibility HOT 5
- Initial feedback after migrating to csv2 HOT 2
- trailing missing value unrecognized HOT 1
- How to solve problem? error: no matching function for call to. HOT 2
- warning when compiled with clang 11 HOT 1
- Parsing error
- Empty file can not be parsed HOT 1
- could you make a package? (tag/release) HOT 2
- adding a cell view
- llvm does not get -> in CellIterator
- csv2_test fail under msvc HOT 1
- Empty line ends on segfault HOT 1
- why template class Reader ? HOT 1
- Benchmarking "Denver Crime Data" database
- Compiling Tests fails HOT 2
- Compiling test failed with `error: size of array ‘altStackMem’ is not an integral constant-expression` HOT 1
- Compiler error due to C++17 feature being used HOT 1
- Empty quoted data consumes next cell
- RowIterator doesn't overload operator==
- the csv writer doesn't quote cell values even if value contains reserved characters
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 csv2.