Art of BI: C# Convert Decimal to String
Author: Christian Screen | | July 13, 2009
Microsoft usually has good documentation but on this particular topic, I always felt that it was lacking. Here is the MS core documentation for converting a decimal to a string, http://msdn.microsoft.com/en-us/library/59095yyw.aspx.
I recently needed to ensure that I was only getting only two decimal places on a dollar amount as I converted it into a string and was going to write a nice long post myself and then I found this really nice post over at csharp-examples (view post).
Mainly I was looking for the following syntax just to ensure that I was setting up things correctly:
// just two decimal places
String.Format("{0:0.00}", 123.4567); // "123.46"
String.Format("{0:0.00}", 123.4); // "123.40"
String.Format("{0:0.00}", 123.0); // "123.00"
They have some other great custom formatting items as well. Check ’em out.
Related Posts
Oracle BI Publisher (BIP) Tips: Functions, Calculations & More
Check out these BI Publisher tips including functions & calculations so you can understand more about the production and support of BI Publisher reports.
Qlik vs. Tableau vs. Power BI: Which BI Tool Is Right for You?
Tableau, Power BI, and Qlik each have their benefits. What are they and how do you choose? Read this blog post for a quick analysis.
How to Index a Fact Table – A Best Practice
At the base of any good BI project is a solid data warehouse or data mart.