I wrote a small program that generates CSV files for large data testing. The data is generated in a sequential matter.
For example the output in the txt file flows like this:
ID_1,A_1,B_1,C_1,D_1,E_1,F_1
ID_2,A_2,B_2,C_2,D_2,E_2,F_2
ID_3,A_3,B_3,C_3,D_3,E_3,F_3
My problem is that I want to add a certain number of 0's in front of the records depending on the number of numeric characters already generated.
For example for the first record it should be:
ID_00000001,A_00000001,B_00000001,C_00000001,D_00000001,E_00000001,F_00000001
But for record 356 it should be:
ID_00000356,A_00000356,B_00000356,C_00000356,D_00000356,E_00000356,F_00000356
So I need it to pad a certain number of 0's depending on the already present number 0's, what should I attempt to achieve this?