DynamicQuantities.jl
DynamicQuantities.jl copied to clipboard
Round tripping Quantities through String
Hi, thanks for the package, nice to have an alternative approach to the Unitful type-based one.
Is there a way in this package to convert back and fourth between Quantities and String representations so that quantities could be serialised to strings and parsed back again? Like in Unitful, string(q::Quantity)
prints a space between the last numeral and the unit, which yields an error with uparse
.
Just so I understand, would you want a way to parse the current pretty-printed output? Or would you want to have a printing function that gives something you can directly type into the REPL?
Btw, is there a function in Base for prints that aim to give a string representation that can be typed back into the REPL? Like some show(::IO, ::Val{:raw}, x)
or something?
Just so I understand, would you want a way to parse the current pretty-printed output? Or would you want to have a printing function that gives something you can directly type into the REPL?
I suppose either would suit my needs, maybe parsing units with the space might make more sense as "2 mL"/1 nM" etc is a pretty common way to write these quantities for humans!
Btw, is there a function in Base for prints that aim to give a string representation that can be typed back into the REPL? Like some show(::IO, ::Val{:raw}, x) or something?
I was looking and didn't find it, though I did realise I don't understand Julia's display system as well as I should.
Also worth noting a similar issue with Unitful: https://github.com/PainterQubits/Unitful.jl/pull/470