Genesys Cloud - Main

 View Only

Discussion Thread View
  • 1.  Left Trim 0's from a string in architect

    Posted 12-05-2019 04:42
    Dear PureCloud

    Wishing you are well.

    I have a variety of numbers that can return from a data action. For example
    00006789
    00678678
    000678678

    The first number will always start with a 0, and there may be more than one 0. There will always be a number after 0, which is where I want to start the new string.

    Does Architect have a function to cater for this, please?
    #ArchitectureandDesign

    ------------------------------
    Thanks and regards
    Samuel Polgar
    CVT (Global) Pty Ltd
    ------------------------------


  • 2.  RE: Left Trim 0's from a string in architect

    Posted 12-05-2019 09:00
    Edited by Dan Fontaine 12-05-2019 09:02
    It'd be great if we could use a regular expression for this but you can use:

    ToInt() to trim the leading zeros
    and then convert it back to a string using ToString() if you need it as a string.

    ToInt("00040567098") yields 40567098
    ToString(40567098) yields "40567098" 

    You could get back to a string in one step by: ToString(ToInt(variable)) 

    Of course this only works with the example strings you provided because the strings are composed of digits.

    ------------------------------
    Dan Fontaine
    Altivon
    ------------------------------



  • 3.  RE: Left Trim 0's from a string in architect

    Posted 12-06-2019 03:59

    Hello Dan

     

    Hope you are well.

     

    Thank you very much for your advice on a fix, that's extremely helpful and I look forward to testing with the return from our data action.

     

    Thanks and regards

    Samuel






  • 4.  RE: Left Trim 0's from a string in architect

    Posted 12-10-2019 17:27
    You could use a substitution loop.  Just look at each character of the string and drop whatever you want from the front.

    ------------------------------
    Robert Wakefield-Carl
    Avtex Solutions, LLC
    Contact Center Innovation Architect
    robertwc@avtex.com
    https://RobertWC.Blogspot.com
    ------------------------------



Need Help finding something?

Check out the Genesys Knowledge Network - your all-in-one access point for Genesys resources