Giter VIP home page Giter VIP logo

Comments (2)

p-ranav avatar p-ranav commented on May 21, 2024

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.

sergioferrari avatar sergioferrari commented on May 21, 2024

Thank you so much for your answer.

from csv2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.