String.Format Articles

C# Custom Number Formatting

Very often the inbuilt numerical formatting in C# will be insufficent and you will want to apply the custom formatting for your numbers. The String.Format method is very flexible and can be used to apply custom formatting rules. The # character informs the Format method how to format the numerical value, for example to forma […]

Read more

Formatting Numerical Data in C#

C# ships with several inbuilt formatting specifies which can be used to quickly format a number, for example the ‘c’ specifier will format the number as a currency: double dbl1 = 9999999.9999999; outputStr = string.Format(“This is the currency format {0:c}”, dbl1); This will output the numerical value as a currency based on the user’s current […]

Read more