I've made a sort of "stopwatch" in my app. Basically, I have an int (let's call it number
) that increments every 0.1 seconds, and a label (let's call it label
) that updates when number
does. label
's text is the String form of number
.
This is working fine, but I'd like to get my label to have the "old-school video game" format, with zeros before the numbers themselves. For example, when number
is actually 4, I want label
to say "00004." When number
is 2,341, I want label
to say "02341." Etc.
How do I do this? I can take answers in either Swift or Objective-C.