posted 13 years ago
In a past life, I could implement a C string-formatting function with multiple, varying (or no) arguments using stdargs.h functionality, no looping and, for example, vsprint(). Please indulge me here: I'm a (very old) C hack trying to mend his ways.
In my new life, I'd like to wrap String.format() that way into a method that accepts multiple, varying (or no) arguments, to wit:
I think the rub is obvious: String.format() is not happy with unmatched conversion specifiers (java.utl.MissingFormatArgumentException). I need a sort of String.vformat() that takes a variable-length array of Objects à la C. My loop here will instead build an Object[]. Or is there magic glue by which I can move objects from the argument list of buildStatement() to String.format()?
As penance in my new life, I try to resist rolling my own in favor of using existing, tried and true solutions out of standard libraries.
Thanks in advance for any help you can give me,
Russ Bateman