Sprintf should allow for number formatting
- Dominant language
- Java
- Stars
- 14.9k
- Forks
- 3.5k
- Avg merge
- 19h 14m
- Merged PRs (30d)
- 63
Description
## Problem
Our `sprintf` function really just does interpolation. This is insufficient if you want more specific string formatting, say limiting a `float` to two places of precision.
One particularly problematic area here is the case of `BigDecimal` values, as seen in #5808 . All `BigDecimal` values print out as scientific notation, even very small ones like `0.96E2%` which is really terrible to read.
## Solution
We should add a new syntax that uses java's [Formatter](https://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html) to handle this. The syntax could look like: `"Here's a message with a %{fieldname:0.2f}". In this case we've added the format after the colon much like a grok pattern.
Contributor guide
Assessment
This issue has not been assessed yet.