Sha256: 585aafc8b15c385e77d9a5d6114a5c3dca8d7ad13ce47eb497798b8e666a042d

Contents?: true

Size: 823 Bytes

Versions: 595

Compression:

Stored size: 823 Bytes

Contents

module Puppet::Parser::Functions

  newfunction(
  :split, :type => :rvalue,
  :arity => 2,

    :doc => "\
Split a string variable into an array using the specified split regexp.

*Example:*

    $string     = 'v1.v2:v3.v4'
    $array_var1 = split($string, ':')
    $array_var2 = split($string, '[.]')
    $array_var3 = split($string, Regexp['[.:]'])

`$array_var1` now holds the result `['v1.v2', 'v3.v4']`,
while `$array_var2` holds `['v1', 'v2:v3', 'v4']`, and
`$array_var3` holds `['v1', 'v2', 'v3', 'v4']`.

Note that in the second example, we split on a literal string that contains
a regexp meta-character (.), which must be escaped.  A simple
way to do that for a single character is to enclose it in square
brackets; a backslash will also escape a single character.") do |args|

    Error.is4x('split')
  end
end

Version data entries

595 entries across 595 versions & 3 rubygems

Version Path
puppet-7.34.0 lib/puppet/parser/functions/split.rb
puppet-7.34.0-x86-mingw32 lib/puppet/parser/functions/split.rb
puppet-7.34.0-x64-mingw32 lib/puppet/parser/functions/split.rb
puppet-7.34.0-universal-darwin lib/puppet/parser/functions/split.rb
puppet-7.33.0 lib/puppet/parser/functions/split.rb
puppet-7.33.0-x86-mingw32 lib/puppet/parser/functions/split.rb
puppet-7.33.0-x64-mingw32 lib/puppet/parser/functions/split.rb
puppet-7.33.0-universal-darwin lib/puppet/parser/functions/split.rb
puppet-7.32.1 lib/puppet/parser/functions/split.rb
puppet-7.32.1-x86-mingw32 lib/puppet/parser/functions/split.rb
puppet-7.32.1-x64-mingw32 lib/puppet/parser/functions/split.rb
puppet-7.32.1-universal-darwin lib/puppet/parser/functions/split.rb
puppet-7.31.0 lib/puppet/parser/functions/split.rb
puppet-7.31.0-x86-mingw32 lib/puppet/parser/functions/split.rb
puppet-7.31.0-x64-mingw32 lib/puppet/parser/functions/split.rb
puppet-7.31.0-universal-darwin lib/puppet/parser/functions/split.rb
puppet-7.30.0 lib/puppet/parser/functions/split.rb
puppet-7.30.0-x86-mingw32 lib/puppet/parser/functions/split.rb
puppet-7.30.0-x64-mingw32 lib/puppet/parser/functions/split.rb
puppet-7.30.0-universal-darwin lib/puppet/parser/functions/split.rb