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

Variable Width/Precision Without Index in fmt #4845

Merged

Conversation

Barinzaya
Copy link
Contributor

This allows * to be used in format strings in C fashion, without specifying an argument index to use. Like C, this results in the argument preceding the value for the format specifier itself.

Examples:

fmt.printfln("%*s", 16, "foo") // (13 spaces)foo
fmt.printfln("%*.*f", 16, 3, math.PI) // 000000000003.142
fmt.printfln("%.*f", 6, math.PI) // 3.141593

This allows `*` to be used in C fashion, without specifying an argument
index to use. Like C, this results in the argument *preceding* the value
for the format specifier itself.
@gingerBill gingerBill merged commit 9dc4d5a into odin-lang:master Feb 20, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants