I’d like to format an integer in a way that it has leading zeros and thousand separators at the same time.
I know that someInt.ToString("D6"); will give me leading zeros, but apparently it doesn’t allow NumberGroupSeparator. On the other hand someInt.ToString("N"); will give me separators but no leading zeros…
Is it possible to combine both to print 123456 as 00 123 456? I know I can get string created with N and then manually add zeros to string in a loop or something, but maybe there’s better way?
EDIT:
Number of padding zeros (total digits length of number) should be adjustable.
If you want 00 123 456, just do:
If you need a fixed amount of zero’s, all I can think of is this: