My requirement is to remove the duplicate values from a rule input of type text. Here is a sample input and output.
Input: Hello hello Hello there there past pastures
Output: Hello there past pastures
Discussion posts and replies are publicly visible
There maybe more elegant ways, but something like this:
a!localVariables( local!trimmed: fn!trim(ri!inputString), local!split: fn!split(local!trimmed, " "), local!lower: fn!lower(local!split), local!union: fn!union(local!lower, local!lower), local!result: a!forEach( items: local!union, expression: if( fv!isFirst, concat(fn!proper(fv!item), " "), concat(fv!item, " ") ) ), fv!concat(local!result) )
Notes:
hi stewart, is there an guide for fn! functions somewhere ? not all functions are available as fn! but is there any simple rule like all functions without a! or a page to explain them. Just curious....
Hi AKASH T,
can you try this one
a!localVariables( local!string:union(split(lower("Hello hello Hello there there past pastures")," "),split(lower("Hello hello Hello there there past pastures")," ")), substitute(tostring(local!string),";"," "))
Works well But the result will be displayed in lower case.