Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Surprising parse results with . and - #246

@jl-wynen

Description

@jl-wynen

unit_from_string produces some unexpected results when parsing strings with periods or dashes. E.g. all of the following are equivalent to "m*s":

"m.s"
"m. s"
"m.s."
"m. s."
"m- s"

But spacing matters and "m-s" is parsed as milliseconds.

This came up for us with "a.u." which was intended as 'arbitrary units' but was parsed as "1.66054e-25*m**2*kg**1".

Is it a design choice to interpret . as * and drop - when there are no numbers?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions