search text key word from a sentence

Certified Associate Developer

i have a sentence that "Benefit Period: To Age 75; Indexation: CPI Linked" in this I need to validate that whether "Indexation: CPI Linked" is found or not 

please give me a suggestion

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    Hi  

    You can use find() or search() function to check if a word is there or not in your text and then add a condition to get the boolean value. find or search function gives you the index of the word you are searching in the text string. so if you get 0 as a result then it means the word you searched is not available hence you can get output as false and if it gives any non zero integer , it means you found the word in your text string. See below example.

    a!localVariables(
      local!position: find(
        "Indexation: CPI Linked",
        "Benefit Period: To Age 75; Indexation: CPI Linked"
      ),
      if(local!position = 0, false, true)
    )

Reply
  • 0
    Certified Senior Developer

    Hi  

    You can use find() or search() function to check if a word is there or not in your text and then add a condition to get the boolean value. find or search function gives you the index of the word you are searching in the text string. so if you get 0 as a result then it means the word you searched is not available hence you can get output as false and if it gives any non zero integer , it means you found the word in your text string. See below example.

    a!localVariables(
      local!position: find(
        "Indexation: CPI Linked",
        "Benefit Period: To Age 75; Indexation: CPI Linked"
      ),
      if(local!position = 0, false, true)
    )

Children
No Data