txtFabricProcessingCost.Text = String.Format("{0:F2}", totalProcessCost);
txtFabricProcessingCost.Text = totalProcessCost.ToString("#0.00");
txtFabricProcessingCost.Text = totalProcessCost.ToString("N2");
txtFabricProcessingCost.Text = totalProcessCost.ToString("N3");
double v = 17688.65849;
double v2 = 0.15;
int x = 21;
string str = String.Format("{0:F2}", v); // 17688.66
str = String.Format("{0:N5}", v); //17,688.65849
str = String.Format("{0:e}", v); //1.768866e+004
str = String.Format("{0:r}", v); //17688.65849
str = String.Format("{0:p}", v2); //15.00%
str = String.Format("{0:X}", x); //15
str = String.Format("{0:D12}", x); //000000000021
str = String.Format("{0:C}", 189.99); //$189.99
Coding Spirit is a blog for sharing general programming related concepts (usually) .NET, Asp.net, C#.net, Jquery, Ajax, Sql Server, PHP, MySql and any other as well as some discussion of programming concepts.
Friday, May 7, 2010
String Formats For Decimal Values
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment