Basically I’m trying to make an extension to “clean up” filenames by removing underscores, periods and hyphens, converting it to title case, and ignoring the file extension.
Turn “random_picture_you.downloaded.from-the-internet.jpg” into “Random Picture You Downloaded From the Internet.jpg”
I’ve got the first part down: remove periods, hyphens and underscores.
But I don’t know how to convert it to Title Case or how to preserve the dot before the extension (.jpg | .pdf | .mp3 | .doc) or if it’s even possible.
Currently the way I do it is I select everything but the file extension part, use the PopClip extension I have to remove the unwanted characters and use PopClip’s Title Case extension.
I would like to combine all those steps or at least two of them to make the whole task smoother.
This is the extension I’ve got:
#popclip
name: Clean filename
icon: circle filled fn
javascript:
let text = popclip.input.text;
text = text.replaceAll(/[_]/g, ' ');
text = text.replaceAll(/[-]/g, ' ');
text = text.replaceAll(/[.]/g, ' ');
popclip.pasteText(text);
How would I go about converting it to Title Case and maybe telling the extension to ignore the .jpg
part?