surround

Puppet function to add both a prefix and suffix to a string or each element of an array.

deanwilson

deanwilson

7,012 downloads

7,012 latest version

5.0 quality score

Version information

  • 1.0.0 (latest)
released Nov 27th 2015
This version is compatible with:
  • RedHat, Ubuntu, Debian, Fedora, CentOS

Start using this module

Documentation

deanwilson/surround — version 1.0.0 Nov 27th 2015

puppet-surround

The surround() function adds a prefix and a suffix to the string or each element of the array it is passed as a first argument.

A basic string example:

surround('mystring', '+', '=')
# +mystring=

and working on an array:

surround(['a','b','c'], 'pre-', '-post')
# [ 'pre-a-post', 'pre-b-post' 'pre-c-post' ]

A quick comparison of using surround vs using stdlib:

surround( $mystring, '!', '!')

suffix( prefix( $mystring, '!'), '!')

License

GPL v2.0 - Dean Wilson