-
Notifications
You must be signed in to change notification settings - Fork 122
Closed
Description
The @u_str macro is useful when units are known in advance. In some cases, however, units must be determined at runtime. This requires parsing strings as numeric and Unitful values, which is currently sort of ugly:
val, unit = split(rawValue, " "; limit=2)
return parse(Float64, val)*(@eval @u_str $unit) # uglyI'd like to propose that Unitful include a function which exposes this kind of behavior (i.e. parse quantity from string). It would be good if it were resilient to having a space (or not) between the numeric and the unit.
tlnagy, SebastianM-C, c42f, briochemc, Balinus and 4 more
Metadata
Metadata
Assignees
Labels
No labels