deanwilson-surround

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


License
GPL-2.0
Install
puppet module install deanwilson-surround --version 1.0.0

Documentation

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