Closed bcachet closed 3 years ago
I think it would be feasible to just parse out the string into a value and unit string. You'd be best to just keep them in separate fields or concatenate them using a known separator. I'll try to integrate some quantity parsing logic in the next version, but i'm not to keen on that. If you are looking for a way to easily serialize and deserialize to a string format, you might want to use the JSON serializer. See unittests 'WhenMappingQuantity'
What is the usecase you are looking for?
I want to create a formula interpreter with support of SI units.
User will be able to enter 2ms * 2m/s
and get 4mm
as result.
I am already able to parse/eval a formula that do not have physical units.
Instead of parsing numbers as Integer/Real numbers, I wan to use a Physics parser.
Hello,
I really like your library design. Most of the libraries I found on NuGet (https://github.com/objorke/QuantityTypes) do not define a Dimension. So you have to define the operators /,* for all the conversions you are interested in.
I see that it is possible to convert a string to a Unit. Is it possible to perform a conversion from string to Quantity ? If not, what approach do you recommand ?
Thanks for your excellent work
Bertrand