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

@printf does not accept * to specify field width #19582

Closed
eschnett opened this issue Dec 13, 2016 · 3 comments
Closed

@printf does not accept * to specify field width #19582

eschnett opened this issue Dec 13, 2016 · 3 comments
Labels
domain:display and printing Aesthetics and correctness of printed representations of objects.

Comments

@eschnett
Copy link
Contributor

I want to use this printf specification:

@sprintf "%0*d" len id

This should format the integer id using len digits, filled with 0 characters. The C printf supports the * specifier. Julia should offer an equivalent feature.

@stevengj stevengj added the domain:display and printing Aesthetics and correctness of printed representations of objects. label Sep 12, 2019
@quinnj
Copy link
Member

quinnj commented Sep 8, 2020

I think this would be much easier to do now that #32859 is merged; it updates all the Printf code to use more modern dispatch patterns rather than relying on an insane amount of straight code generation.

@johanmon
Copy link
Contributor

I added this:
#40105

@laborg
Copy link
Contributor

laborg commented Oct 19, 2023

This works now:

julia> @sprintf "%0*d" 5 42
"00042"

@laborg laborg closed this as completed Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:display and printing Aesthetics and correctness of printed representations of objects.
Projects
None yet
Development

No branches or pull requests

5 participants