
July 25, 2016 20:20 by
Dan

Must Know Issue: Basics of String Format in .Net
Numeric Format
double dValue = 55000.54987D;
//displaying number in different formats
Response.Write("Currency Format: " + dValue.ToString("C") + "
");
Response.Write("Scientific Format: " + dValue.ToString("E") + "
");
Response.Write("Percentage Format: " + dValue.ToString("P") + "
");
/* OUTPUT */
Currency Format: $55,000.55
Scientific Format: 5.500055E+004
Percentage Format: 5,500,054.99 %
Getting Culture Specific String
double dValue = 55000.54987D;
//You can Remove this line
Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
//This line will automatically detect client culture
//and display data accordingly
//Here culture has forcefully changed to german to
//view difference in output
CultureInfo ci = Thread.CurrentThread.CurrentCulture;
//displaying number in different formats
Response.Write("Currency Format: " + dValue.ToString("C",ci) + "
");
Response.Write("Scientific Format: " + dValue.ToString("E",ci) + "
");
Response.Write("Percentage Format: " + dValue.ToString("P",ci) + "
");
/* OUTPUT */
Currency Format: 55.000,55 €
Scientific Format: 5,500055E+004
Percentage Format: 5.500.054,99%
Best ASP.NET Core 1.0 Hosting Recommendation
ASPHostPortal.com provides its customers with Plesk Panel, one of the most popular and stable control panels for Windows hosting, as free. You could also see the latest .NET framework, a crazy amount of functionality as well as Large disk space, bandwidth, MSSQL databases and more. All those give people the convenience to build up a powerful site in Windows server. ASPHostPortal.com offers ASP.NET hosting starts from $1/month only. They also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable ASP.NET Hosting, ASPHostPortal.com should be your best choice.
371ed5e7-2189-4dc7-86ce-09b38fc6859b|0|.0