1
decimal value = 10000;
var str = value.ToString("N0").Replace(",",".");
Output : 10.000

Is there a better way to seperate digits without using Replace ?

  • See the marked answer in the duplicate. Use the `customCulture` in that answer as the `IFormatProvider` in `ToString` as the 2nd argument. – Igor Nov 26 '17 at 11:53

1 Answers1

0

Try like this;

decimal value = 10000;
var str = value.ToString("N0",CultureInfo.CurrentCulture);

Also, you can configure the culture as you wish. Like;

CultureInfo.CreateSpecificCulture("en-En")

Please refer this post;

https://msdn.microsoft.com/tr-tr/library/system.globalization.cultureinfo.createspecificculture(v=vs.110).aspx

lucky
  • 12,734
  • 4
  • 24
  • 46