foundry-rs / foundry-rs/foundry
Feature request: `String.format` with specifiers
- Dominant language
- Rust
- Stars
- 10.6k
- Forks
- 2.6k
- Avg merge
- 18h 20m
- Merged PRs (30d)
- 510
Description
Console logging [supports](https://book.getfoundry.sh/reference/forge-std/console-log#consolelogformatargs) format specifiers like `%s` and `%d`.
It would be helpful to have something similar for formatting strings, e.g. equivalent to Java's [`String.format`](https://www.javatpoint.com/java-string-format).
As per https://github.com/foundry-rs/foundry/pull/2313, I gather that the format specifier logic is implemented in Rust, not Solidity. But I went ahead and created this issue because I think it's a highly desirable feature, especially for use cases like [NFT SVGs](https://github.com/Uniswap/v3-periphery/blob/6cce88e63e176af1ddb6cc56e029110289622317/contracts/libraries/NFTSVG.sol).
Contributor guide
Assessment
This issue has not been assessed yet.