Change to Title case from 40th character

Javascript renaming examples. Javascript renaming is supported in version 3 or newer.

Change to Title case from 40th character

Postby quangtran25111 » Mon Mar 02, 2020 3:10 am

Could you please help me on changing case of file name from the 4th posision character? Thank a lot!
From: Change to Title case from 40th character to the end of file name
To: Change to Title case from 40th character To The End Of File Name
quangtran25111
 
Posts: 1
Joined: Mon Mar 02, 2020 3:03 am

Re: Change to Title case from 40th character

Postby RegexNinja » Sun Mar 08, 2020 9:28 am

Hi
To replace Space(AnyLowerCase) with Space(UpperCase) beginning at the filename's 40th-character:

BRU javascript:
newName=name.substr(0,40)+name.substr(40).replace(/( [a-z])/g, function(up){return up.toUpperCase()})

BRC commandline:
brc32 /MinLen:41 /Insert:"|:40" /ReplaceCI:" |: | " /CutFirstN:39 /ChangeCase:T /PasteAtStart /ReplaceCI:"|:" /TidyDS /Execute
Does the same thing in a different way, in this order:
1. Insert | as the 40th-char
2. IF | was inserted after Space: Add another space after |
3. Cut the 1st 39-chars
4. Apply Title case-conversion (against the remaining 40th-char onward)
5. Paste the 1st 39-chars back into filename (at start)
6. Remove the | character
7. Convert double-spaces -> single-space (possibly created during step 2)
RegexNinja
 
Posts: 134
Joined: Fri Feb 21, 2020 5:26 pm


Return to Javascript Renaming