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/29 13:48:00 UTC

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

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

             Summary: 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


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|https://community.hortonworks.com/questions/99856/nifi-padding-string.html] to achieve left or right padding are unintuitive and could require to instantiate additional processors

h1. Improvement Proposal
- Support two new expression language methods
-- padLeft() will add characters on the left of the string until a certain size is reached
--- padLeft(int n) will add a default character at the left of the input string until it reaches the length n
--- padLeft(int n, char c) will add the c characters at the left of the input string until it reaches the length n
-- padRight()
--- padRight(int n) will add a default character at the right of the input string until it reaches the length n
--- padRight(int n, char c) will add the c characters at the right of 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)