how to parse a string into a phobos datatype with additional logic

yawniek via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Apr 7 04:38:50 PDT 2016


On Thursday, 7 April 2016 at 08:03:34 UTC, Edwin van Leeuwen 
wrote:
> You can try this library:
> https://code.dlang.org/packages/dateparser

nope this will not work and the question is broader:
i want to have a standard datatype parsed in a specific way and 
so that i can
use other std library tools such as csvparser to then do the job.

parsing unixtime with subsecond resolution was just one example, 
there is a lot of cases
where you want to do some tranformation e.g. "33%" -> 0.33f

my solution with defining a custom struct works, but it would be 
nice if you somehow could hook into this process in a cleaner way.






More information about the Digitalmars-d-learn mailing list