It would be nice if this worked natively. Probably not too difficult to implement, but I'm not sure how package extensions work.
julia>using Format, Unitful
julia> x =12345.6u"lbf"12345.6 lbf
julia>format(x, commas=true, precision=0)
ERROR: MethodError: no method matching format(::Quantity{Float64, 𝐋 𝐌 𝐓^-2, Unitful.FreeUnits{(lbf,), 𝐋 𝐌 𝐓^-2, nothing}}; commas::Bool, precision::Int64)
The function`format` exists, but no method is defined for this combination of argument types.Workaround:
julia>format(ustrip(x), commas=true, precision=0, suffix="$(string(unit(x)))")
"12,346 lbf"
It would be nice if this worked natively. Probably not too difficult to implement, but I'm not sure how package extensions work.
Workaround: