Capital letter in character position number 20th

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

Capital letter in character position number 20th

Postby MS1986 » Fri Dec 15, 2017 12:47 pm

Hello all,

Can anyone help me? I am not a programer amd I am a bit lost. I use the bulk rename utility to change the names of thousands of files, but I am unable to get a specific character or letter, the one in position number 20th, to be "case" or capital letter, for a lot of files. A kind member told me that it's easy with the JavaScript Renaming tool, but of course I am not a programer and I don't know where to begin...

Can somebody be kind enough to tell me the code of the JavaScript Renaming in order to change the 20th character of the file from normal to capital letter?

Like this:

The example - 01 - the example

The example - 01 - The example

Thank you very much!! :)
MS1986
 
Posts: 6
Joined: Fri Dec 15, 2017 11:47 am

Re: Capital letter in character position number 20th

Postby Admin » Mon Dec 18, 2017 2:19 am

Code: Select all
String.prototype.replaceAt=function(index, replacement) {
    return this.substr(0, index) + replacement+ this.substr(index + replacement.length);
}

var pos = 20;
pos--;
var str = name;
var strup = str.toUpperCase();
strup = str.replaceAt(pos,strup.substr(pos,1));

newName = strup;


Copy and paste into the Javascript editor.

var pos = 20 specifies position and it can be changed as needed.
Admin
Site Admin
 
Posts: 2343
Joined: Tue Mar 08, 2005 8:39 pm

Re: Capital letter in character position number 20th

Postby MS1986 » Mon Dec 18, 2017 10:46 am

OMG that was amazing!!!!

Thank you very much for your time and kindness!!!

A huuuge hug from Spain my friend!!! :)
MS1986
 
Posts: 6
Joined: Fri Dec 15, 2017 11:47 am


Return to Javascript Renaming