You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are at least one or two cases where SimpleUnitFormat.parse() (or AbstractUnit.parse()) won't recognize a string that can be properly formatted, it seems related to prefixes where observed.
E.g. AbstractUnit.parse("dm") works just the same way as DECI(METRE).toString(), but the result of DECI(CARAT).toString() fails parsing it with AbstractUnit.parse("dct").
Note CARAT is defined by the extension module Unicode CLDR, but it should not really matter if the unit is defined by the RI itself or an extension.
The text was updated successfully, but these errors were encountered:
keilw
changed the title
SimpleUnitFormat.parse() sometimes does not work with prefixes
SimpleUnitFormat.parse() does not always work with prefixes
Apr 17, 2021
I have also encountered this when using a custom unit (of geologic time, the "annus" with symbol "a") that I defined in my own SystemOfUnits. I took care to register a label with SimpleUnitFormat, so I can parse it when the unit does not have a prefix. But when I instantiate the unit with a metric prefix and try to parse the result of calling toString() (e.g., "Ma" or "ka") it fails.
There are at least one or two cases where
SimpleUnitFormat.parse()
(orAbstractUnit.parse()
) won't recognize a string that can be properly formatted, it seems related to prefixes where observed.E.g.
AbstractUnit.parse("dm")
works just the same way asDECI(METRE).toString()
, but the result ofDECI(CARAT).toString()
fails parsing it withAbstractUnit.parse("dct")
.Note
CARAT
is defined by the extension module Unicode CLDR, but it should not really matter if the unit is defined by the RI itself or an extension.The text was updated successfully, but these errors were encountered: