Farr, Aaron wrote:

Hello.

A bit off topic, I suppose, but anyone know of a good printf replacement for
java.  The avalon logkit pattern formatter is close (very close), but not
quite what I need.  I'm somewhat surprised I haven't found anything in
Jakarta commons, but perhaps I just don't know where to look.

Any ideas?

Sorry. None that I know of. Alot of Java developers jumped into Java. They aren't aware of printf() style functions in C libraries. There is one thing that makes them somewhat unfriendly to write is the fact that there is no support for arbitrary parameter length methods. Something to support that would have to have a parameter list like this:

String sprintf(String format, Object[] params);
void oprintf(OutputStream out, String format, Object[] params);
void printf(String format, Object[] params);

Writing code for this is not friendly.  Esp. since normal parameters like
integers and floats need to be wrapped, calling such a thing would be
less than wonderful.

printf("Add a %s string, and a %f.01 float",
   new Object[] {"parameterized", new Float(3.14237f)});

I personally think that is too much trouble, which lowers the utility
of such a thing IMO.  Besides, we have the Message.format() from the
i18n utilities to perform things like that.

--

"They that give up essential liberty to obtain a little temporary safety
 deserve neither liberty nor safety."
                - Benjamin Franklin


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to