Re: [Puppet Users] 'substr' function

2014-09-04 Thread Jonathan Gazeley
Apparently it is also possible with regsubst, like this: regsubst($hostname, '^(.{7})(.*)', '\1') On 04/09/14 10:28, Martin Alfke wrote: I assume that you can use the sprintf function (from Puppet core). sprintf("%20.8s", "string test") #=> "string t" On 04 Sep 2014, at 11:19, Jon

Re: [Puppet Users] 'substr' function

2014-09-04 Thread Martin Alfke
I assume that you can use the sprintf function (from Puppet core). sprintf("%20.8s", "string test") #=> "string t" On 04 Sep 2014, at 11:19, Jonathan Gazeley wrote: > Another dumb question, but I can't find what I'm looking for. Does Puppet > have a function that's equivalent to t

[Puppet Users] 'substr' function

2014-09-04 Thread Jonathan Gazeley
Another dumb question, but I can't find what I'm looking for. Does Puppet have a function that's equivalent to the substr() function in Perl? I want to truncate arbitrary strings to 7 chars but I can't see how to do this with any of the built-in functions or functions in stdlib. e.g. substr('h