Open
Description
I am trying to parse a CSV and convert a column that holds the sex of a person into a Nullable{Bool}
My attempts failed:
sex_parser = CustomParser(Bool) do str, i, len, opts
return (len == 0 ? Nullable{Bool}() : Nullable{Bool}(str[i] == 'M'), len == 0 ? i : i + 1)
end
I spent couple of hours reading the docs and the code, but I do not understand what the str
is that the tryparsenext
receives in a readcsv
context, and whether my CustomParser must be aware of the delimiter symbol.
For example, consider a CSV with ';' delimiter:
123;F;6789;
124;M;6712;
125;;6716;
Is str
a row and my custom parse receives pos=5, len=1
for the first row and pos=5, len=0
for the third row?
And after a successful parse in row one, do I return 6 or 7. The doc is saying "position the next token, if any, starts at", that sound like my parser needs to be aware of my delimiter!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment