String. Is format (. Net) equivalent in Java?
•
Java
. Net Format (maybe just VB. Net) converts {0}, {1},... To a determined string, for example:
Dim St As String = "Test: {0},{1}" Console.WriteLine(String.Format(St,"Text1","Text2"))
I tried to search in Google and stackoverflows, but both returned numeric string format
Solution
Other suggestions are certainly good, but more is the style of printf and its pedigree, which is the latest addition to Java Your published code looks inspired by message format
String format = "Test: {0},{1}" System.out.println(messageformat.format(format,"Text2"))
I'm not sure what you're doing
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码