Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing of 1/mile is not possible #413

Open
acimail01 opened this issue Jan 17, 2024 · 1 comment
Open

Parsing of 1/mile is not possible #413

acimail01 opened this issue Jan 17, 2024 · 1 comment
Labels
Milestone

Comments

@acimail01
Copy link

acimail01 commented Jan 17, 2024

SimpleUnitFormat.getInstance().alias(USCustomary.MILE, "mile");
Quantity<?> q1 = ServiceProvider.current().getFormatService().getQuantityFormat().parse("3 km");
Quantity<?> q2 = ServiceProvider.current().getFormatService().getQuantityFormat().parse("3 mi");
Quantity<?> q3 = ServiceProvider.current().getFormatService().getQuantityFormat().parse("3 mile");
// Quantity<?> q4 = ServiceProvider.current().getFormatService().getQuantityFormat().parse("3 1/km"); // Exception
Quantity<?> q5 = ServiceProvider.current().getFormatService().getQuantityFormat("EBNF").parse("3 1/km");
// Quantity<?> q6 = ServiceProvider.current().getFormatService().getQuantityFormat("EBNF").parse("3 1/mi"); // Exception
// Quantity<?> q7 = ServiceProvider.current().getFormatService().getQuantityFormat("EBNF").parse("3 1/mile"); // Exception

Parsing of 1/km with Simple-Parser is not possible
Parsing of 1/mile wirh EBNF-Parser is not possible

@keilw
Copy link
Member

keilw commented Feb 29, 2024

Could you please elaborate the use case for this?

Even in the UCUM Specification which is by far the most extensive catalog of units there is no definition of "1/km", "1/kg" or similar, meaning it would likely fail against UCUMFormat or UCUM's own test suites as well.

@keilw keilw added the format label Oct 1, 2024
@keilw keilw added this to the 2.2.1 milestone Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants