Uploaded image for project: 'CFEngine Community'
  1. CFEngine Community
  2. CFE-3074

string_trim() policy function

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Done
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.16.0
    • Component/s: cf-agent
    • Labels:
    • Story Points:
      0

      Description

      A function to trim whitespace from beginning and end of a string would be useful:

      bundle agent main
      {
        vars:
          "with_spaces" string => "  word  ";
          "trimmed_spaces" string => string_trim("$(with_spaces)");
      }
      

      It should trim CR, LF(newline), space and tab by default. In a future iteration, it can be expanded with an optional argument to specify what to trim.

      Should be very easy to implement.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                lluis Lluís Campos
                Reporter:
                olehermanse Ole Herman Schumacher Elgesem
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Summary Panel