You are not logged in.
WARNING: DO NOT POST YOUR QUESTIONS IN TOPICS THAT ARE YEARS OLD! START A NEW THREAD!
"What if I only want to add a hyphen, before only the 2nd capitalized word?"
Below is a script which will do what you want.
Adjust "InsertBeforeCapitalizedWord" constant to insert a separator before 1,2,3,4,etc capitalized word.
const
Separator = '_';
InsertBeforeCapitalizedWord = 2;
var
I, CaptializedWordCount: Integer;
begin
CaptializedWordCount := 0;
for I := 2 to Length(FileName) do
begin
if IsWideCharAlpha(FileName[I]) and IsWideCharAlpha(FileName[I-1]) then
if IsWideCharUpper(FileName[I]) and IsWideCharLower(FileName[I-1]) then
begin
CaptializedWordCount := CaptializedWordCount + 1;
if CaptializedWordCount = InsertBeforeCapitalizedWord then
begin
WideInsert(Separator, FileName, I);
Break;
end;
end;
end;
end.
Last edited by den4b (2015-10-06 09:50)
Offline