revati
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.
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #ai
- #elixirconf-us
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 1- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
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.