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

Limitations of java.util.Formatter (and String.format) #3407

Closed
sjrd opened this issue Jul 5, 2018 · 2 comments
Closed

Limitations of java.util.Formatter (and String.format) #3407

sjrd opened this issue Jul 5, 2018 · 2 comments
Assignees
Labels
enhancement Feature request (that does not concern language semantics, see "language")
Milestone

Comments

@sjrd
Copy link
Member

sjrd commented Jul 5, 2018

After the big rewrite of #3380 and its numerous fixes, there are still a few things that are not supported in java.util.Formatter and therefore in String.format:

  • Hexadecimal format for floating point numbers with %a.
  • Formatting of BigIntegers and BigDecimals.
  • Formatting of date/times with the %t. family.

The first two might be doable at some point. Formatting dates would bring in way to much code in every Scala.js application, and there are better APIs for that now in java.time anyway.

See also #3202 which records that %f, %e and %g have rounding discrepancies compared to the JVM.

@gzm0 gzm0 added enhancement Feature request (that does not concern language semantics, see "language") help wanted The core team will not work on this issue. Help from the community is wanted. labels Oct 9, 2018
@pfcoperez
Copy link
Contributor

pfcoperez commented Oct 15, 2020

I had a patch for BigInteger formatter and I was opening an issue to describe what it fixes when I found this issue so I ended up not opening another one 😅

This is the PR with the patch fixing b.formatted("%d"), b.formatted("%o") and b.formatted("%x"): #4255

@sjrd sjrd self-assigned this Feb 28, 2021
@sjrd sjrd removed the help wanted The core team will not work on this issue. Help from the community is wanted. label Feb 28, 2021
@sjrd sjrd added this to the v1.5.1 milestone Feb 28, 2021
@sjrd
Copy link
Member Author

sjrd commented Mar 7, 2021

An update here:

In addition, the related issue #3202 was fixed in #4443.

That leaves only the date/time conversions, for which I have created a separate issue #4447.

So this one can be closed now.

@sjrd sjrd closed this as completed Mar 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request (that does not concern language semantics, see "language")
Projects
None yet
Development

No branches or pull requests

3 participants