字串補齊(padLeft)

padLeft function padLeft(str, lenght) {
    if (str.length >= lenght) return str;
    else return padLeft("0" + str, lenght);
}

PadLeft及PadRight @ 男丁格爾 in Xuite
convert '1' to '0001' in JavaScript - Stack Overflow