I’m trying to print physical quantities from a decimal datatype with up to 6 decimal places. I want the thousands separator to show up, but only for numbers that are >= 10,000 (or <= -10,000).
For instance:
- 100 -> 100
- 1000 -> 1000
- 9999 -> 9999
- 10000 -> 10,000
I’ve been using this format, but it’s not quite right:
myNumber.ToString("#,##0.######");
Is there a trick to the format string to get the thousands separator to only show up if there are 5 or more digits to the left of the decimal place?
I don’t think there is any special trick, you’ll have to do