support for `parse`
CNOT opened this issue · comments
It would be nice if parse
knew how to handle Measurement
type numbers.
Something on the following lines, might work:
import Base.parse
function parse(::Type{Measurement}, s::AbstractString)
n = parse.(Float64,split(s,"±"))
return n[1]±n[2]
end
This is handy when you have Measurement type data produced and stored as a string, for example in a CSV file.
It already does: https://juliaphysics.github.io/Measurements.jl/stable/examples/#Measurements-from-Strings-1
julia> using Measurements
julia> parse(Measurement{Float64}, "4 ± 1.3")
4.0 ± 1.3