Is there a easy way to transform 1000000 in 1.000.000? A regex or string format in asp.net, c#
If what you want are all possible three digit numbers with no repetition of the digits then you have 10 choices for the first digit, you have 9 choices for the 2nd digit, and you have 8 choices for the 3rd digit giving you 10x9x8 = 720 in all.
You can use ToString
together with a formatting string and a format provider that uses '.' as a group separator and defines that the number should be grouped in 3-digit groups (which is not the case for all cultures):
int number = 1000000;
Console.WriteLine(number.ToString("N0", new NumberFormatInfo()
{
NumberGroupSizes = new[] { 3 },
NumberGroupSeparator = "."
}));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With