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 20:32:00 UTC

[jira] [Updated] (NIFI-6502) add padLeft() and padRight() functions to RecordPath

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

Alessandro D'Armiento updated NIFI-6502:
----------------------------------------
    Description: 
h2. Current Situation

- [Record path functions|https://nifi.apache.org/docs/nifi-docs/html/record-path-guide.html#functions] don't provide anything to perform string padding

h1. Improvement Proposal
- Support two new recordPath functions
-- padLeft:
--- padLeft(string field, int desiredLength) will prepend a default character to the input string until it reaches the length desiredLength
--- padLeft(String field, int desiredLength, char c) will prepend the c characters to the input string until it reaches the length n
-- padRight:
--- padRight(string field, int desiredLength) will append a default character to the input string until it reaches the length desiredLength
--- padRight(String field, int desiredLength, char c) will append the c characters 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

----
{
  "name" : "john smith"
}
----

`padLeft(/name, 15, '@')` => @@@@@john smith
`padLeft(/name, 15)` =>  _____john smith
`padRight(/name, 15, '@')` => john smith@@@@@
`padRight(/name, 15)`=> john smith_____

  was:
h2. Current Situation

- [Record path functions|https://nifi.apache.org/docs/nifi-docs/html/record-path-guide.html#functions] don't provide anything to perform string padding

h1. Improvement Proposal
- Support two new recordPath functions
-- padLeft:
--- padLeft(string field, int desiredLength) will prepend a default character to the input string until it reaches the length desiredLength
--- padLeft(String field, int desiredLength, char c) will prepend the c characters to the input string until it reaches the length n
-- padRight:
--- padRight(string field, int desiredLength) will append a default character to the input string until it reaches the length desiredLength
--- padRight(String field, int desiredLength, char c) will append the c characters 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

----
{
  "name" : "john smith"
}
----

`padLeft(/name, 15, '@')` | @@@@@john smith
`padLeft(/name, 15)` | _____john smith
`padRight(/name, 15, '@')` | john smith@@@@@
`padRight(/name, 15)` | john smith_____


> add padLeft() and padRight() functions to RecordPath 
> -----------------------------------------------------
>
>                 Key: NIFI-6502
>                 URL: https://issues.apache.org/jira/browse/NIFI-6502
>             Project: Apache NiFi
>          Issue Type: New Feature
>          Components: Core Framework
>    Affects Versions: 1.9.2
>            Reporter: Alessandro D'Armiento
>            Priority: Minor
>
> h2. Current Situation
> - [Record path functions|https://nifi.apache.org/docs/nifi-docs/html/record-path-guide.html#functions] don't provide anything to perform string padding
> h1. Improvement Proposal
> - Support two new recordPath functions
> -- padLeft:
> --- padLeft(string field, int desiredLength) will prepend a default character to the input string until it reaches the length desiredLength
> --- padLeft(String field, int desiredLength, char c) will prepend the c characters to the input string until it reaches the length n
> -- padRight:
> --- padRight(string field, int desiredLength) will append a default character to the input string until it reaches the length desiredLength
> --- padRight(String field, int desiredLength, char c) will append the c characters 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
> ----
> {
>   "name" : "john smith"
> }
> ----
> `padLeft(/name, 15, '@')` => @@@@@john smith
> `padLeft(/name, 15)` =>  _____john smith
> `padRight(/name, 15, '@')` => john smith@@@@@
> `padRight(/name, 15)`=> john smith_____



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