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 ?
Thanks
Discussion posts and replies are publicly visible
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.
Agree with Mike.
You can also use reduce if you you're looking to replace a bunch of different text items in a string.
a!localVariables( local!text: "Are the machines property stickered(external communication) something else", local!keys: { "(external communication)", "something else" }, local!values: { "", "" }, trim( reduce( substitute(_, _, _), local!text, merge(local!keys, local!values) ) ) )