I’m trying to format my double to be in US dollar currency format, but I do not want trailing 00‘s if the value comes out to be a whole number.
I have tried
String.Format("{0:#,0.#0}", cost);
and
String.Format("{0:#,0.##}", cost);
The former is leaving me trailing 00 on whole number, and the latter is will give me 55.6 where I want 55.60. How can I format my value to meet both of these needs?
I don’t think that’s possible with a standard format string, but a trick would be:
or:
I know, it’s ugly…