C # currency format with leading spaces?

I am trying to duplicate a text report written in an icon in C #. The report has:

Blah Blah........ $  10,938.09
Blah Blah........ $       3.88
Blah Blah........ $ 102,398.11

I can use several formatting requests to achieve this result without problems, for example:

Console.WriteLine(string.Format("Blah Blah.....${0,10}", number.ToString("#,##0.00")));

but I would think that there is a way to do this with a single call to string.Format (). Any idea how to insert leading spaces in currency format?

+3
source share
1 answer

You do it like this:

Console.WriteLine(string.Format("Blah Blah.....${0,10:#,##0.00}", number));

Update:

This is an important part of the documentation.

+7
source

All Articles