Remove total words from a sentence

Certified Senior Developer

Hi Team,

I would like to remove total words from a sentence, Below is the sentence

Are the machines property stickered(external communication)

I need to remove(external communication) from the above one, Strip with or clean with cant be used because it will remove other letters also

Any suggestions ?


  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    The previous answer(s) will work, however I'd personally recommend going with a function that's targeted specifically to this sort of use case, rather than trying to play around with "split()" unnecessarily, and having to deal with the consequences of the fact that it naturally outputs an array (which you'd have to handle and account for).

    So for that I'd suggest "substitute()", which hunts for a whole sub-string and replaces it with a whole different sub-string (which can just be a blank value if desired).  That would end up looking like this:

    This also cleanly handles if the input string doesn't have the target substring for removal - in these cases the output is simply untouched.

    FYI the Appian Documentation has a comprehensive list of all Text Functions (as well as all other OOB functions), and I strongly recommend keeping the link handy.

  • 0
    Certified Lead Developer
    in reply to Mike Schmitt

    Agree with Mike.

    You can also use reduce if you you're looking to replace a bunch of different text items in a string.

      local!text: "Are the machines property stickered(external communication) something else",
      local!keys: { "(external communication)", "something else" },
      local!values: { "", "" },
          substitute(_, _, _),
          merge(local!keys, local!values)

Reply Children
No Data