How to format a String into Money - newbie

  • Thread starter Thread starter Bob Geltz
  • Start date Start date
B

Bob Geltz

This may be a simple question, but I'm new and stumped.
I need to display a string like currency ( $123.00). I cannot find the
correct format call to make it happen. Using C#. Don't care if the $$ is
present or not, need to always display a number to two decimal place
accuracy. Help.

bob.
 
Check out numeric string formatting.

double amt = 1.0 / 3.0;
Console.WriteLine( amt );
Console.WriteLine( amt.ToString("$#,##0.00") );

--Jim
 
Bob, you can also do something as followings, (note the :C in the fomat method)

double d = 2
string s = string.Format("{0:C}", d)

-Nick Parker
 
Back
Top