The first several code snippets are potentially dangerous. What if the number you're starting with already has more digits than the maximum? In that case, the first digits will get cut off, e.g. 123456 will become 3456.
Andrew's final code snippet is the only one that behaves correctly in that case. (12 becomes 0012, but 123456 remains 123456).
Padding Zeros to an Index eg 10 becomes 0010
Padding Zeros to an Index eg 10 becomes 0010
otherthings wrote:The first several code snippets are potentially dangerous.
That's true. But I think it clear from the thread that the first several posts don't contain valid code. This tread started in the 'help' section. Andrew moved it here because his last post is useful.
Mike
That's true. But I think it clear from the thread that the first several posts don't contain valid code. This tread started in the 'help' section. Andrew moved it here because his last post is useful.
Mike