string.padWithZeros
| Syntax |
string.padWithZeros (num, places)
|
| Params |
num is a number. places is the desired length of the resulting string.
|
| Action |
Converts num to a string, then adds zeros to the beginning of the string until it has indicated number of characters.
|
| Returns |
The resulting string.
|
| Examples |
string.padWithZeros (7, 3) » "007"
string.padWithZeros (1015, 7)
string.padWithZeros (random (0, 9), 7)
string.padWithZeros (1234, 3) //doesn't truncate longer numbers
|
| Notes/bugs |
It doesn't handle negative numbers well.
|