Reputation: 375
Hi want to convert in C# a double 1123$ to 1.123,00 (one thousand and two decimal).
How can I do that?
thanks
Upvotes: 0
Views: 883
Reputation: 3574
You might want to use this
YourDecimal.ToString("N",new CultureInfo("nl-NL")) // this will result in 1.000,00 for example
YourDecimal.ToString("N",new CultureInfo("en-US")) // this will result in 1,000.00 for example
Or you could set the culture in Web.Config if you're using ASP.NET.
You can also pick any other culture if that matches the dot and comma delimiter ofcourse. These are just examples.
Upvotes: 1
Reputation: 405
Try:
var text = money.ToString("N0",
System.Globalization.CultureInfo.GetCultureInfo("de"));
Upvotes: 1