How to capitalize first letter of each word

Post any Bulk Rename Utility support requirements here. Open to all registered users.

How to capitalize first letter of each word

Postby gacapp » Tue Feb 20, 2018 8:01 pm

Great Utility!! Use it all the time. Can someone show me how to change the first letter of each word in a file name.

So if I have for example:

rock and roll all nite

How can I change it to:

Rock And Roll All Nite


Any help would be greatly appreciated!!
gacapp
 
Posts: 1
Joined: Tue Feb 20, 2018 7:59 pm

Re: How to capitalize first letter of each word

Postby Admin » Wed Feb 21, 2018 2:01 am

Hi, you can use this Javascript function in BRU:

Code: Select all
function toTitleCase(str)
{
    return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
}

newName = toTitleCase(name)
Admin
Site Admin
 
Posts: 2343
Joined: Tue Mar 08, 2005 8:39 pm

Re: How to capitalize first letter of each word

Postby therube » Wed Feb 21, 2018 5:43 pm

14:Case -> Title, may handle what you need.
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: How to capitalize first letter of each word

Postby Admin » Thu Feb 22, 2018 12:58 am

Yes, that too :) :shock: :oops:
Admin
Site Admin
 
Posts: 2343
Joined: Tue Mar 08, 2005 8:39 pm

Re: How to capitalize first letter of each word

Postby YiannisKan » Sun Jul 14, 2019 4:47 pm

Can you please adjust the code so it can capitalize all first letters of all words ?
YiannisKan
 
Posts: 1
Joined: Sun Jul 14, 2019 4:16 pm

Re: How to capitalize first letter of each word

Postby therube » Mon Jul 15, 2019 8:55 pm

14:Case -> Title, may handle what you need.
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: How to capitalize first letter of each word

Postby r0tt3nnn » Tue Apr 12, 2022 8:57 pm

For anyone trying to find this answer in 2022, know that the Case functionality now has its own section - Section 4.

Image
r0tt3nnn
 
Posts: 1
Joined: Tue Apr 12, 2022 8:55 pm

Re: How to capitalize first letter of each word

Postby spamwisegamgee » Mon Apr 25, 2022 7:57 am

r0tt3nnn wrote:For anyone trying to find this answer in 2022, know that the Case functionality now has its own section - Section 4.

Image


Just dropping in to let you know that as a guy who was wondering in 2022 and stumbled across this post, you helped. Thank you.
spamwisegamgee
 
Posts: 1
Joined: Mon Apr 25, 2022 7:54 am


Return to BRU Support


cron