Open keilw opened 3 years ago
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")
. NoteCARAT
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.