www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Java gets Formatter class

reply "Ben Hinkle" <bhinkle mathworks.com> writes:
I hadn't realized this before, but Java 1.5 includes a printf formatter:
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html
Finally! :-)
It's very spiffy. It includes things like argument reordering and date/time
formatting.

-Ben
Oct 11 2004
next sibling parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Ben Hinkle wrote:
 I hadn't realized this before, but Java 1.5 includes a printf formatter:
 http://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html
 Finally! :-)
 It's very spiffy. It includes things like argument reordering and date/time
 formatting.

%n is cool too. It outputs the platform's choice of line ending. --anders
Oct 11 2004
prev sibling next sibling parent "Walter" <newshound digitalmars.com> writes:
It's surprising how similar it is to std.format, although there are
significant differences (for one, the formatter is not an object in
std.format).

"Ben Hinkle" <bhinkle mathworks.com> wrote in message
news:ckes8i$253j$1 digitaldaemon.com...
 I hadn't realized this before, but Java 1.5 includes a printf formatter:
 http://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html
 Finally! :-)
 It's very spiffy. It includes things like argument reordering and

 formatting.

 -Ben

Oct 11 2004
prev sibling parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Ben Hinkle wrote:
 I hadn't realized this before, but Java 1.5 includes a printf formatter:
 http://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html
 Finally! :-)
 It's very spiffy. It includes things like argument reordering and date/time
 formatting.

I see, Java's new way of doing varargs is neat. And I'm a bit surprised (considering awkward syntactic salt I've seen in Java before) that it's decided to invent implicit conversions between primitive types and their standard wrapper classes. Stewart.
Oct 12 2004
parent Helmut Leitner <helmut.leitner wikiservice.at> writes:
Stewart Gordon wrote:
 
 Ben Hinkle wrote:
 I hadn't realized this before, but Java 1.5 includes a printf formatter:
 http://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html
 Finally! :-)
 It's very spiffy. It includes things like argument reordering and date/time
 formatting.

I see, Java's new way of doing varargs is neat. And I'm a bit surprised

Why are you surprised?
 (considering awkward syntactic salt I've seen in Java before) that it's
 decided to invent implicit conversions between primitive types and their
 standard wrapper classes.

The immediate competitor C# does it. That's motivation enough.
 Stewart.

-- Helmut Leitner leitner hls.via.at Graz, Austria www.hls-software.com
Oct 12 2004