[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (format "Hello %1$S%2$s" 'world "!")
From: |
Vivek Dasmohapatra |
Subject: |
Re: (format "Hello %1$S%2$s" 'world "!") |
Date: |
Sun, 2 Jul 2017 17:56:43 +0100 (BST) |
User-agent: |
Alpine 2.02 (DEB 1266 2009-07-14) |
Also, the syntax is very heavy. Was it inspired by another programming
language? The ones I'm familiar with use $1, {1}, or similar syntax, but
I've never seen %1$s :/
From printf(3):
By default, the arguments are used in the order given, …
One can also specify explicitly which argument is taken, at each place
where an argument is required, by writing "%m$" instead of '%' and "*m$"
instead of '*', where the decimal integer m denotes the position in the
argument list of the desired argument, indexed starting from 1. Thus,
printf("%*d", width, num);
and
printf("%2$*1$d", width, num);
https://en.wikipedia.org/wiki/Printf_format_string#Parameter_field
I don't know when POSIX introduced it, but it's been around for a while.
- Re: prin1 / princ vs message ?, (continued)
- Re: prin1 / princ vs message ?, Philipp Stephani, 2017/07/02
- Re: prin1 / princ vs message ?, Jean-Christophe Helary, 2017/07/02
- (format "Hello %1$S%2$s" 'world "!"), Clément Pit-Claudel, 2017/07/02
- Re: (format "Hello %1$S%2$s" 'world "!"), Jean-Christophe Helary, 2017/07/02
- Re: (format "Hello %1$S%2$s" 'world "!"), Noam Postavsky, 2017/07/02
- Re: (format "Hello %1$S%2$s" 'world "!"), Clément Pit-Claudel, 2017/07/02
- Re: (format "Hello %1$S%2$s" 'world "!"), Noam Postavsky, 2017/07/02
- Re: (format "Hello %1$S%2$s" 'world "!"), Clément Pit-Claudel, 2017/07/02
- Re: (format "Hello %1$S%2$s" 'world "!"),
Vivek Dasmohapatra <=
Re: prin1 / princ vs message ?, Stefan Monnier, 2017/07/02