Remove square brackets from frontmatter value

How do I remove the “[” “]” brackets if I want to change the file name with Templater and the value of a frontmatter entry from another file is to be used?

Things I have tried

in my frontmatter is an entry:

projekt: projekt_with_a_pretty_long_title__1
projCode: abc123
objekttype: Projekt

in the template I try via templater

<%* const dv =["dataview"].api; 
let projects = dv.pages();
let all_projects = projects.where(p => p.objekttype == "Projekt").sort(n =>; 

let akTitle = all_projects.projCode;

but when I try to rename the file with the akTitle variable via:

<% tp.file.rename(akTitle + "-"+ %>

the filename goes:


how can I remove those brackets?

well, I fiddled it out by myself…
I had to convert the value to string via:

let akTitle = String(all_projects.projCode);

and then in the rename/ move code via the slice method:

<% tp.file.move('myPath/' + akTitle.slice(1, -1) + "-"+ %>

maybe there is another dude who finds this useful…eventually.

Thanks to all who have kept an eye on it.

til next time :wink: