revati
Determine type with NimbleParsec?
i want to parse string and determine if value is string/number/boolean/date/time/datetime/probably many more distinct value value types in future.
How to approach this. do i create parse for each separate option and than one choice?
But i have this caveat. for example for boolean, either it is word true or number 1 they can be casted to string or number respectively. Workaround for this might be, that seems ok from business point of view to have prefix or suffix, like boolean:1 or 1:boolean. and if this type casting prefix/suffix is present force that type for parser.
I don’t understand nimble parsec at that level, but i believe prefix is a lot easier (but still pretty hard - at least for me), but bossiness much rather would prefer suffix ![]()
someStringValue → string someStringValue
1 → integer 1
1.4 → float 1.4
1.4:string → string 1.4
1:boolean → boolean true
etc. If you have some hints, ideas how to approach this, i would greatly appreciate it.
Most Liked
LostKobrakai
I’d separate parsing the string to tokens of interest and then bringing those tokens together with whatever business logic you have around it.







