In my application i create multiple files and i would like them to have consecutive numbering as part of the name. For example log_0001, log_0002
I use string interpolation, so in code it looks like
fileName = "log_\(number)"
number = number + 1
However, if i keep number
as just Int
, i will have log_1 instead of log_0001
I've only figured that i could check if number
has 1/2/3/4 digits and add '000/00/0' manually.
Are there any String modifications allowing to put the required number of '0' to make it 4 symbols?