[
https://issues.apache.org/jira/browse/NIFI-15649?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18062388#comment-18062388
]
ASF subversion and git services commented on NIFI-15649:
--------------------------------------------------------
Commit 5854916aa393fc8fa948b0c2fe4cb4d29d3f661d in nifi's branch
refs/heads/main from mcducks
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=5854916aa39 ]
NIFI-15649 Add compactDelimitedList() and trimDelimitedList() Expression
Language functions
* compactDelimitedList removes all empty tokens from delimited strings
* trimDelimitedList removes only leading/trailing empty tokens, preserving
interior empties
* Handles multi-character delimiters
* Added unit tests in TestQuery
* Updated ANTLR grammar (lexer and parser)
* Integrated into ExpressionCompiler
* Added documentation to expression language guide
This closes #10938.
Signed-off-by: Pierre Villard <[email protected]>
> 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
> Priority: Minor
> Time Spent: 10m
> Remaining Estimate: 0h
>
> 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)