Hello,
I have a solution for this problem, but looking to improve it or create more elegant way.
Here is the example:
I have one number which will be maximum of 6 digits.
If the number is 4 digits, I must add two 0 at the start of this document -> 001234
If the number is only one digit, I must add five 0 at the start of the documen ->> 000004
I need always to have 6 digit number.
The first solution that come in my mind was this:
Create variable to store the number of digits.
Multiple IF statements where I check the length and
these IF statements will be repetitive until IF Counter = 1
The second one itβs almost the same. I think itβs not good idea, because itβs not even easy readable for the human. In every ELSE statement inside of the IF statement, I put a new IF statement for the next length.
Is there any possible way to make it better and simpler instead of recreate from the first example?