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 <[email protected]> 
wrote:

> 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('hello', 4) returns 'hell'
> 
> Thanks,
> Jonathan
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/puppet-users/54082EBE.4020509%40bristol.ac.uk.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/BAC0D913-AAEA-459A-B899-23DF6944307F%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to