Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-6782

Create EL function for repeating a string

    XMLWordPrintableJSON

Details

    Description

      As per a discussion with mattyb149, an Expression Language function which allowed for a number of repetitions of a string would be useful for generating arbitrary random text in a GenerateFlowFile processor. The usage would be:

      ${"some string here":repeat(4)} # repeats the literal string 4 times
      ${literal("this_is_also_an_attribute_name"):repeat(3)} # repeats the literal string 3 times
      ${my_string_attr:repeat(5)} # repeats the value in the attribute 5 times
      ${"explicit string":repeat(random():mod(10):plus(1))} # repeats the string between 1 and 10 times
      

      If it's easy to implement, I think a multiple parameter option would also be convenient, but it is not a requirement:

      ${"explicit string":repeat(random():mod(10):plus(1))} # repeats the string between 1 and 10 times
      ${"explicit string":repeat(1, 10)} # identical behavior to above
      

      Attachments

        Issue Links

          Activity

            People

              mattyb149 Matt Burgess
              alopresto Andy LoPresto
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 50m
                  2h 50m