I am running a loop that adds a number of lines to a draft using:
d.content = d.content + addedtext + "\n";
This works fine, but adds a return for the last item in the loop. Struggling to figure out how to essentially hit the backspace key and remove the last “\n”. Any elegant ways to do this?
The Javascript String object trim method is also handy to know about. join makes more sense here, but if you have input you may need to strip of whitespace to make sure you don’t end up with extra line feeds, it’s useful. It removes any whitespace at the beginning and end.
Indeed - was looking at trim first - trying to put that in place elsewhere. Adapting the add to Drafts List action to prepend or append, but running into issues with the ## Title portion of the note. Probably not right for this thread - but this is where a seperate “title” portion of a note would be nice to have…