Genesys Cloud - Main

 View Only

Sign Up

  Thread closed by the administrator, not accepting new replies.
  • 1.  How to find character first occurrence in a string?

    Posted 03-08-2022 04:00
    No replies, thread closed.
    Hello Community,

    does Architect have an analog of  "indexOf" function?
    I need to find the first occurrence of a specified character in a string that I receive from a custom web service.

    Thanks,
    Irina


    #ArchitectureandDesign

    ------------------------------
    Irina Milstein
    ITNAV-Pro Ltd.
    ------------------------------


  • 2.  RE: How to find character first occurrence in a string?

    Posted 03-08-2022 09:10
    No replies, thread closed.
    Hi Irina,

    You can use FindString function which returns the location of a specified occurrence of a String within a String.
    Hope this helps



    ------------------------------
    Samrat Som
    Genesys - Employees
    ------------------------------



  • 3.  RE: How to find character first occurrence in a string?

    Posted 03-08-2022 09:13
    No replies, thread closed.
    FindString
    Searches for the first occurrence of a String within a String by doing a case sensitive match. If textToFind find is "", a -1 will be returned.

    Return Value
    Integer : Returns the zero-based index of the first occurrence of a String within a String by doing a case sensitive match.

    Parameters
    String stringToSearch : The String that will be scanned.

    Examples
    FindString("Hello", "ll")
    Output
    2

    ------------------------------
    Dan Fontaine
    ConvergeOne, Inc.
    ------------------------------



  • 4.  RE: How to find character first occurrence in a string?

    Posted 03-08-2022 10:12
    No replies, thread closed.
    Thanks for help, guys!

    ------------------------------
    Irina Milstein
    ITNAV-Pro Ltd.
    ------------------------------



  • 5.  RE: How to find character first occurrence in a string?

    Posted 03-09-2022 11:04
    No replies, thread closed.
    Irina,

    https://regex101.com/ is a good resource to test regex code against strings and it's free. Glad you were able to get help from the community.

    Thank you,

    Eric

    ------------------------------
    Eric Allen
    Vervent, Inc.
    ------------------------------



  • 6.  RE: How to find character first occurrence in a string?

    Posted 03-09-2022 11:47
    No replies, thread closed.
    Generally speaking Architect does not support regex.  The only time you can use regex is in a slot type in a bot flow.  For any purpose, you are restricted to functions defined by Architect (FindString is one of them).  See https://help.mypurecloud.com/articles/access-functions-help/

    ------------------------------
    Melissa Bailey
    Genesys - Employees
    ------------------------------