Jump to content

- String Helper Functions

- # StringLeft()

  Followers 0

  Lua SwxWare v13.10

  This helper function returns the given number of characters from the left side of the given string.

      local sLeft = StringLeft(str, len)

  This function returns a string value.

  Examples:

      local sLeft = StringLeft("Erika Mustermann", 5)

      PBXScript.OutputTrace("sLeft = " .. sLeft)

      --> sLeft = Erika

      local tConfig = nil
      local sPublicLineAccess = ""

      tConfig = PBXScript.GetPBXConfig()
      sPublicLineAccess = tConfig.publicaccessprefix
      PBXScript.OutputTrace ("Configured public line access: " .. sPublicLineAccess)

      -- check forwarding
      if (PBXUser.UnconditionalRedirect()) then

          PBXScript.OutputTrace ("Unconditional call forwarding configured to " .. PBXUser.UnconditionalRedirectNumber())

          if (StringLeft(PBXUser.UnconditionalRedirectNumber(), StringLen(sPublicLineAccess)) == sPublicLineAccess) then
              PBXScript.OutputTrace ("External call forwarding configured")
              bReturn = true
          else
              PBXScript.OutputTrace ("Internal call forwarding configured")
          end

      else
          PBXScript.OutputTrace ("No unconditional call forwarding configured")
      end

  By Tom Wellige

  - June 9, 2022
  Share
  Share
  Followers 0
  Previous Page IsString()
  Next Page StringLen()

## 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.