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
- common lisp We may get something out of this http://www.supelec.fr/docs/cltl/clm/node200.html
- Java Similar to sprintf http://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html
- Php Implement padding with arbitrary character but I am pretty sure we wont use the same ;-) http://www.usphp.com/function.sprintf.html
Other documentation I found shows that most languages mimic C sprintf()
Regards
Pascal