int a = 10000000; a.ToString();
How do I make the output?
10,000,000
Try N0 for no decimal part:
N0
string formatted = a.ToString("N0"); // 10,000,000
How can I do this elegantly with C# and .NET 3.5/4? For example, a number can be between 1 and 100. I know a simple if would suffice; but the keyword to this question is elegance. It's for my toy project not for …
How can I get a count of the total number of digits of a number in C#? For example, the number 887979789 has 9 digits.
Instead of doing this, I want to make use of string.format() to accomplish the same result: if (myString.Length < 3) { myString = "00" + 3; }