#1 : 17/03-19 04:06 Jesson
Posts: 6
|
I'm trying to think of a pattern to capitalize all 2 letter words but fails to do so. Could anyone help? Thanks in advance.
|
#2 : 17/03-19 09:17 Stefan
Posts: 274
|
Reply to #1:
You can try List replace method https://www.advancedrenamer.com/user_guide/metho d_listreplace on > ON is > IS to > TO but best with "[x]Use regular expressions" \bon\b > ON \bis\b > IS \bto\b > TO |
#3 : 17/03-19 10:54 David Lee
Posts: 1125
|
Reply to #1:
To capitalize ALL two letter words you will need to use a Regular Expression in a script. Enter the following function as the pre-batch script: function changeCase(str) { return str.replace(/\b\w*/g, function(txt){ if (txt.length == 2) { txt = txt.toUpperCase(); } return txt; }); } Then in the main script window: return changeCase(item.name); |
#4 : 17/03-19 11:17 David Lee
Posts: 1125
|
Reply to #3:
My previous script will leave existing capitalization of non-two-letter words unchanged. If you want ONLY two letter words capitalized then convert the filenames to lowercase before calling the function in the pre-batch script. ie - in the main script window: return changeCase(item.name.toLowerCase()); |
#5 : 17/03-19 11:50 Jesson
Posts: 6
|
Reply to #2:
Thank you for your effort but that is not what I'm looking for as it is very inefficient if I were to capitalized all 2 letter words |
#6 : 17/03-19 11:59 Jesson
Posts: 6
|
Reply to #3:
It works. I knew scripting method was unavoidable. I don't know anything about how scripting work or how to make one so I avoid it. I thought it could be achieved efficiently without scripting method so I tried asking in the forum. Maybe Kim should add a this feature? Anyway problem solved and thanks to all |