# How to use the chop funtion in stdlib to remove the last character of a string in puppet 4.10

I tried this, but getting the same name as the output.

$database_name = "${facts['database_name']}"
$trundbname = chop("${database_name}")
notify{"Ouput of trundbname = ${trundbname}":} Any thoughts would be really helpful edit retag close merge delete ## 1 Answer Sort by » oldest newest most voted That function works as you want. You should check your strings carefully. It's likely that you have characters you're not expecting.$ puppet apply -e 'notice(chop("foobar"))'
Notice: Scope(Class[main]): fooba
Notice: Compiled catalog for ganymede.corp.puppetlabs.net in environment production in 0.16 seconds

Side note: This isn't Bash. You don't have to wrap variables in strings if they're already a string. In other words, "${facts['database_name']}" is redundant. Just use the variable:${facts['database_name']

more