Top "String.format" questions

A method or function that takes a template string and arguments for that template and inserts these arguments into the template in an appropriate manner (programming-language-independent tag)

Is String.Format as efficient as StringBuilder

Suppose I have a stringbuilder in C# that does this: StringBuilder sb = new StringBuilder(); string cat = "cat"; sb.Append("the ").…

c# vb.net performance stringbuilder string.format
Make String.format("%s", arg) display null-valued arguments differently from "null"

Consider the custom toString() implementation of a bean: @Override public String toString() { String.format("this is %s", this.someField); } This …

java string null string-formatting string.format
C++ Equivalent of %ld in Java for String.format()

For instance, %11.2lf in C++ becomes %11.2f in Java. How about for long format?

java string.format
Exception in thread "main" java.util.MissingFormatArgumentException: Format specifier '10s'

I'm no doubt missing something really obvious here but I can't figure it out. Any help would be appreciated. The …

java string string.format
Forming Json Format String

I am using this method to form json string and this is working fine. But i can't handle this if …

c# string.format
String.Format for currency on a TextBoxFor

I am trying to get @String.Format("{0:0.00}",Model.CurrentBalance) into this @Html.TextBoxFor(model => model.CurrentBalance, new { @class = "required …

c# asp.net-mvc-3 string.format
How does string.Format handle null values?

In the following code below, why do the two string.Format calls not behave the same way? In the first …

c# .net string.format
Double string.format

I have some double values I want to convert to a string with this pattern: 0.xx or x.xx Currently …

c# .net string.format
String.Format exception when format string contains "{"

I am using VSTS 2008 + C# + .Net 2.0. When executing the following statement, there is FormatException thrown from String.Format statement, any …

c# .net string.format
String.Format: Input string was not in a correct format

The following code keep giving me error saying Input string was not in a correct format, but I am pretty …

c# .net exception-handling string.format