Morgs
Morgs

Reputation: 1746

Number Formatting from $100000 to $100 000,00

Can someone please help format this number: $100000 to $100 000,00. (in words: Hundred Thousand dollars) or if million it must format $100000 to $1 000 000,00

I only know of the standard .NET decimal.ToString( "N2" ) e.g.

decimal number = 1000000d;
string formatedNumber = number.ToString( "N2" ); // This will give you 1,00,000.00

Is there a standard .NET format I can re-use or will I have to create my own?

Upvotes: 1

Views: 2168

Answers (1)

Jevgeni Geurtsen
Jevgeni Geurtsen

Reputation: 3133

        decimal number = 1000000;
        Console.WriteLine(number.ToString("C"), System.Globalization.CultureInfo.CreateSpecificCulture("en-US")); // 1 000.000,00

'C' stands for currency, so yes, there is a standard format for it.

Upvotes: 1

Related Questions