I’ve looked in the forum and on atbref, but can’t find anything — but I may not have used the right search terms. Is there a function which will build a string from another string repeated X times?
E.g. something which would work like this:
$MyString = repeat("#", X)
… which would result in $MyString=="####" when X==4
The nearest I can get to is to use substr: e.g.
$MyString = substr("#######",0,4)
which works, but it feels a bit clunky, and it means I have to guess the maximum number of characters in the ‘dummy’ string.
Context
I want to use it in Export code, and the # probably gives the game away that I want to create the right level of markdown headers for descendants of the selected notes. I want to make sure that whichever level I choose to export, the hierarchy starts with #, children are ## and so on.
The following works, but I wondered if there was a simpler way to build the header.
Indeed: it was the general answer I was after in posting—I had a w0rking solution with substr but wanted a better way. And now I have a general and a specific solution — thanks!