Replace the last letter of a file name with the corresponding alphabet number

Advanced Renamer forum
#1 : 20/10-18 12:46
Simonetos The Greek
Simonetos The Greek
Posts: 2
I want to make a script which will replace the last letter of a filename, to its corresponding alphabet number. For example from "Filename AA" to "Filename A1". Any idea how on can I do that?

Thank you in advance!!!


20/10-18 12:46
#2 : 20/10-18 17:00
David Lee
David Lee
Posts: 1125
Reply to #1:

str=item.name;
num=str.toUpperCase().slice(-1).charCodeAt(0) - 64;
if (num>0 && num < 27) str = str.slice(0, str.length - 1) + num;
return str;


20/10-18 17:00 - edited 20/10-18 17:02
#3 : 21/10-18 11:30
Simonetos The Greek
Simonetos The Greek
Posts: 2
Reply to #2:
Thank you my friend, it worked 100%!!!


21/10-18 11:30