Jump to content
  • AddLeadingZeros()

    AddLeadingZeros()

    Lua   SwxWare v13.10

     

    This helper function takes a string or a number (converts it into a string) and adds leading zeros ("0") until a given length is reached.

     

    local sNumber = AddLeadingZeros(szSource, nExpectedNumberLength)

     

     

    This functions returns a string value.

     

     

    Example:

     

    local nNumber = 2
    local sNumber = AddLeadingZeros(nNumber, 4)
    
    PBXScript.OutputTrace("sNumber = " .. sNumber)
    
    --> sNumber = 0002

     

     


    Tom Wellige
     Share


     Share




×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and have taken note of our Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.