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

[feature request] Reuse the format arguments #1650

Open
Poshi opened this issue Sep 18, 2024 · 0 comments
Open

[feature request] Reuse the format arguments #1650

Poshi opened this issue Sep 18, 2024 · 0 comments

Comments

@Poshi
Copy link
Contributor

Poshi commented Sep 18, 2024

Dear @johnkerl,

sometimes I hit the need of using a parameter for a string format more than once:

put '$result = format("{}/{}/{}_{}.ext", $param1, $param2, $param1, $param3)'

it would be shorter and less error prone (when updating the parameters) to be able to refer to the different parameters from the format string. Something like:

put '$result = format("{1}/{2}/{1}_{3}.ext", $param1, $param2, $param3)'

This is just some syntactic sugar to avoid typing, but not a need. If you decide to follow this path, you can also consider more goodies like the ones that some other languages have: use that string inside the "{}" to also define the format to be given to the parameter being substituted. This could be a rabbit hole, so take care if following this path :-)

Thanks

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

No branches or pull requests

1 participant