Dave Burke : Freelance .NET Web Developer specializing in Online Communities

(Money or Currency) and formatting

A couple of quick options in formatting numbers into pretty dollar values that look like $5,320.00 or some such figure for future reference.
(Mine :-)

In a nutshell, the number converts to decimal and formatted. 

string.Format("{0:C2}", someobj.dollar_amount_as_decimal_type);

Convert.ToDouble(nutherobj.dollar_amount_as_string).ToString("$#.##0.00")

If this were a post at my weblogs.asp.net\dburke blog, there would be a minimum of 10 comments on how to improve these statements, which I always enjoyed.  Today, two will do.  How many Currency Formatters can you ski behind anyway?

 

Comments (0) | Post RSS RSS comment feed

Posted on 11/12/2004 5:48:00 AM by Dave Burke
Categories: .NET
Tags:

Related posts


Powered by BlogEngine.NET 2.0.0.36
Theme by Dave Burke