git-changelog-lib icon indicating copy to clipboard operation
git-changelog-lib copied to clipboard

String.length is not working in handlebars template

Open AndreasScharfCPB opened this issue 2 years ago • 2 comments
trafficstars

I am trying to use substring. But I cannot figure out the length of my String. According to Handlebars a .length should be possible but within the Jenkins pipeline it is not.

Try {{person.lastname.length}} in https://handlebarsjs.com/examples/path-expressions-dot.html

Does not work in Jenkins with {{issue.length}}

AndreasScharfCPB avatar Jun 07 '23 12:06 AndreasScharfCPB

This library uses this implementation of Handlebars: https://github.com/jknack/handlebars.java

I do not see any length helper in those docs.

How do you want to use substring? What is the original value and what do you want it to be after substring?

tomasbjerre avatar Jun 10 '23 06:06 tomasbjerre

oh okay, that would explain why the function is not there. I am using substring on String that is not static to cut the end that I dont need because it is wrapped by "[]". But as I do not know the length of the String I am not able to cut the last character from it.

AndreasScharfCPB avatar Jun 12 '23 07:06 AndreasScharfCPB