You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Alessandro D'Armiento (JIRA)" <ji...@apache.org> on 2019/07/31 09:01:00 UTC

[jira] [Assigned] (NIFI-6500) Add padLeft() and padRight() functions to expression language

     [ https://issues.apache.org/jira/browse/NIFI-6500?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alessandro D'Armiento reassigned NIFI-6500:
-------------------------------------------

    Assignee: Alessandro D'Armiento

> Add padLeft() and padRight() functions to expression language
> -------------------------------------------------------------
>
>                 Key: NIFI-6500
>                 URL: https://issues.apache.org/jira/browse/NIFI-6500
>             Project: Apache NiFi
>          Issue Type: New Feature
>          Components: Core Framework
>    Affects Versions: 1.9.2
>            Reporter: Alessandro D'Armiento
>            Assignee: Alessandro D'Armiento
>            Priority: Minor
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> h2. Current Situation
> - [Expression Language string manipulation|https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#strings] doesn't have anything to perform string padding
> - Existing solutions to achieve left or right padding are unintuitive
> -- Es: ${prop:prepend('0000'):substring(${prop:length()},${prop:length():plus(4)})}
> h1. Improvement Proposal
> - Support two new expression language methods
> -- padLeft:
> --- padLeft(int n) will prepend a default character to of the input string until it reaches the length n
> --- padLeft(int n, char c) will prepend the c characters to the input string until it reaches the length n
> -- padRight:
> --- padRight(int n) will append a default character to the input string until it reaches the length n
> --- padRight(int n, char c) will append the c character to the input string until it reaches the length n
> -- Default character should be a renderable character such as underscore
> -- If the input string is already longer than the padding length, no operation should be performed 
> h3. Examples
> ----
> input = "myString"
> ----
> - ${input:padLeft(10, '#')} => "##myString"
> - ${input:padRight(10, '#')} => "myString##"
> - ${input:padLeft(10)} => "__myString"
> - ${input:padRight(10)} => "myString__"



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)