Git Product home page Git Product logo

Comments (6)

richardellison avatar richardellison commented on May 26, 2024

Using boost::replace_all(line, "\"", "") should allow a reversion to strtok. Since we can pass multiple (single) delimiters to strtok, it should work for the last token as well.

I'll have a go and see how I get on.

from bikedata.

richardellison avatar richardellison commented on May 26, 2024

I remember now why I initially didn't just use strtok with replace_all. It was because I wasn't sure if any of the data would contain strings with commas (in an address for instance). The Citibike data doesn't seem to have this issue but it is something to keep in mind for other systems.

from bikedata.

richardellison avatar richardellison commented on May 26, 2024

One alternative if we want to use strtok together with boost::replace_all would be to use boost::replace_all(line, "\",\"", "?") where instead of the question mark we use an infrequently used character.

from bikedata.

mpadge avatar mpadge commented on May 26, 2024

nah, we've still got comma separators, so can't stick anything but black spaces in (with strok). The good news is that all data thus far from global bike systems is ultimately stored in strict .csv format, so comma's are used exclusively as field delimiters and never as punctuation. That means we can definitely rely on comma separators at all times.

i didn't document my previous attempts, but recall that everything worked fine simply removing double quotes up until the line ending, but I couldn't get strok to properly return the final token. The rm_dos_end function was intended to solve it, but still didn't somehow.

from bikedata.

richardellison avatar richardellison commented on May 26, 2024

In that case I'll go ahead and try removing any speech marks and use strtok.

from bikedata.

mpadge avatar mpadge commented on May 26, 2024

Closing this because strtokm is utlimately still needed because there are cities (such as London) in which station names do have commas, yet are delimited by double quotes. All such cases use strtokm, while all others revert to std::strtok where possible.

from bikedata.

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.