asp.netdecimalnumber-formattingdigit-separator

Format integer number with . as thousand separator and no decimals


I want to print a number with no decimals and a . as the thousand separator. All the example I could Google have a , as a thousands separator.

I've set the CultureInfo to "nl-NL"

So 3200 should be shown as 3.200

I tried:

"3200".ToString("N2")  
"3200".ToString("#.###")
"3200".ToString("0:0")

Solution

  • If you use "nl-NL" then N0 should do it, try this:

        decimal num = 3200;
        num.ToString("N0");