Pascal Viandier wrote:
Padding with arbitrary characters seems an interesting feature. Your syntax is one possibility, but it could be taken to mean that %s would pad with s characters (not very useful in most cases, but perhaps sometimes). Therefore I'd rather suggest some explicit "padding indicator", something like %&*s where & means "pad with" and * is the character to pad with. Note that & is a completely random quick choice by me and probably not the best one. We should look if some C library (or even some other language with similar functionality) has something like this, and if so (and it's not too outlandish ;-), probably try to be compatible. If not, we should look which character is not used for other purposes elsewhere. I haven't looked carefully, so I can't tell ATM.
That's a good suggestion. I will look on my side too.
I found some interesting documentation:
- A specialized language but the documentation is interesting and they implement
padding with arbitrary character http://www.symbian.com/developer/techlib/v8.1adocs/doc_source/guide/Base-sub... em-guide/N1007A/BuffersAndStrings/Descriptors/DescriptorsGuide3/FormatStringSynt ax.guide.html
"The full aligned-conversion is verbose, but in addition to the zero and space characters, it permits non-numeric characters to be specified as the character." -- So, anything except 1-9? Seems strage. (PS: Nice, short URL. ;-)
- Php Implement padding with arbitrary character but I am pretty sure we wont
use the same ;-) http://www.usphp.com/function.sprintf.html
Single quotes are not really most practical for us, no. ;-)
- common lisp We may get something out of this
Also single quotes!?
- Java Similar to sprintf
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html
Yes, I don't see any arbitrary character padding there.
PS: I see another problem. Our existing `@2' might conflict with padding (parameter #2, pad width 10 -> `@210'), so either we must require it to come after padding (if any), or change its syntax (then perhaps to glibc-compatible `2$', which must then always come before padding).
Frank