Templater camelCase filename from prompt title

What I’m trying to do

Short: How to convert “How to convert titles” to “howToConvertTitles”

I’m trying to write a template for my zettelkasting.
I’ve given up on UID filenames (due to obsidian not handling aliases very well) and now want to use the title as a filename.
Being born in the commandline i can’t bring myself to having spaces in filenames.
I do not want to use two prompts (filename / title) but would rather be able to convert a title like “How to convert titles” to filename “howToConvertTitles”.

Any help or hints would make me super happy!

Things I have tried

duckduckgo:ing around!

1 Like

Managed to solve this with javascript - please to reply if there’s a better way!

vTitle is the variable containing the title of the file - from a prompt

function camelCase(str) { 
let ans = str.toLowerCase(); 
return ans.split(" ").reduce((s, c) => s   
(c.charAt(0).toUpperCase() + c.slice(1)));  }   
cCtitle = await camelCase(vTitle)
<% await tp.file.rename(cCtitle) %>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.