Reputation: 551
How can I substring a string like /com/app1/main to get the value of main in a HELM template ?
Upvotes: 7
Views: 20291
Reputation: 4946
The sprig library that Helm uses provides a substr
function to return a sub-string.
Some other useful functions are trunc
(truncate), trim
and regexFind
.
Upvotes: 5
Reputation: 873
You can use the regexFind function in helm
regexFind "[^/]+$" "/com/app1/main"
Will get the text following the last /
Upvotes: 15
Reputation: 969
Helm uses the sprig library to provide lots of data manipulation functions, have a look at their docs. You can use the {{ base }} function to do what you want.
Upvotes: 4