I think you should be using PadLeft
instead of PadRight
.
Take for instance:
1.PadRight(5, '0'); // 10000
10.PadRight(5, '0'); // 10000 (again)
100.PadRight(5, '0'); // 10000 (and again)
You should do PadLeft
in order to avoid duplicates
1.PadLeft(5, '0'); // 00001
10.PadLeft(5, '0'); // 00010
100.PadLeft(5, '0'); // 00100