Is there an equivalent to .NET's String.Format in Java?
String.Format
The 10 cent answer to this is:
C#'s
String.Format("{0} -- {1} -- {2}", ob1, ob2, ob3)
is equivalent to Java's
String.format("%1$s -- %2$s -- %3$s", ob1, ob2, ob3)
Note the 1-based index, and the "s" means to convert to string using .toString(). There are many other conversions available and formatting options:
http://download.oracle.com/javase/1.5.0/docs/api/java/util/Formatter.html#syntax
1.4m articles
1.4m replys
5 comments
57.0k users