#1 2012-04-25 20:08

router7
Member
Registered: 2012-04-25
Posts: 2

Upper case before underscore

I just wanted to start off by saying this program is amazing! I just needed a little help on how to do this, and wondering if someone can give me a hand.

I need to rename files with the following conditions

make everything uppercase before the _ (underscore)

First_Line01
First_Line02

Thanks for the help

Offline

#2 2012-04-25 20:22

router7
Member
Registered: 2012-04-25
Posts: 2

Re: Upper case before underscore

I think I got it! I haven't done pascal in forever and after a bit of searching I figured it out

var
  SplittedFileName: TStringsArray;
begin
  SplittedFileName := WideSplitString(WideExtractBaseName(FileName), '_');
  if Length(SplittedFileName) = 2 then
    FileName := WideUpperCase(SplittedFileName[0]) + '_' + SplittedFileName[1] + WideExtractFileExt(FileName);
end.

Offline

#3 2012-04-25 21:41

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: Upper case before underscore

Welcome. Well done :thumpsup:


I hope you will keep an eye at this forum to help others with scripting too smile




For others, for an how to use read > ReNamer Wiki PascalScript (click)


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

Board footer

Powered by FluxBB