Select Page

Art of BI: C# Convert Decimal to String

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 lengthy 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:
[sourcecode language=’csharp’]
// 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”
[/sourcecode]

They have some other great custom formatting items as well. Check ’em out.

Subscribe to Our Blog

Never miss a post! Stay up to date with the latest database, application and analytics tips and news. Delivered in a handy bi-weekly update straight to your inbox. You can unsubscribe at any time.

12c Upgrade Bug with SQL Tuning Advisor

This blog post outlines steps to take on Oracle upgrade 11.2 to 12.1 if you’re having performance problems. Oracle offers a patch and work around to BUG 20540751.

Megan Elphingstone | March 22, 2017

Oracle EPM Cloud Vs. On-Premises: What’s the Difference?

EPM applications help measure the business performance. This post will help you choose the best EPM solutions for your organization’s needs and objectives.

Bobby Ellis | April 10, 2018

Scripting Out the Logins, Server Role Assignments, and Server Permissions

Imagine over one hundred logins in the source server, you need to migrate them to the destination server. Wouldn’t it be awesome if we could automate the process?

JP Chen | October 1, 2015

Work with Us

Let’s have a conversation about what you need to succeed and how we can help get you there.

CONTACT US

Work for Us

Where do you want to take your career? Explore exciting opportunities to join our team.

EXPLORE JOBS