Richard Scott created NIFI-15649:
------------------------------------

             Summary: Add Expression Language functions compactDelimitedList() 
and trimDelimitedList() for delimited string cleanup
                 Key: NIFI-15649
                 URL: https://issues.apache.org/jira/browse/NIFI-15649
             Project: Apache NiFi
          Issue Type: Improvement
          Components: Extensions
    Affects Versions: 2.8.0
            Reporter: Richard Scott


Add two new Apache NiFi Expression Language functions to simplify cleanup of 
list-like attributes represented as delimited strings.

In NiFi flows, delimited attributes are often built from optional values or 
accumulated over time. This commonly produces leading, trailing, or repeated 
delimiters, resulting in empty tokens such as:
 * {{,a,b,c,,}}

 * {{alpha,,beta,,,gamma}}

 * {{,,a,,b,,}}

Today this usually requires brittle chains of {{{}replace{}}}, regex, or custom 
scripting. Dedicated Expression Language functions would make these common 
cleanup operations easier to read, easier to maintain, and more 
intention-revealing in flows.

 
h3. Proposed Functions
h4. {{compactDelimitedList(delimiter)}}

Removes *all empty tokens* from a delimited string, preserves the order of 
non-empty tokens, and rejoins using the same delimiter.

Examples with delimiter {{{},{}}}:
 * {{,a,b,c,,}} → {{a,b,c}}

 * {{a,,b,,,c}} → {{a,b,c}}

 * {{,,,}} → ``

h4. {{trimDelimitedList(delimiter)}}

Removes only *leading and trailing empty tokens* from a delimited string, while 
preserving {*}interior empty tokens{*}, preserving token order, and rejoining 
using the same delimiter.

Examples with delimiter {{{},{}}}:
 * {{,a,b,c,,}} → {{a,b,c}}

 * {{,,a,,b,,}} → {{a,,b}}

 * {{a,,b,,,c}} → {{a,,b,,,c}}

 * {{,,,}} → ``



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to