ReNamer:Scripts:Separate words

From den4b Wiki
Revision as of 15:07, 3 August 2009 by Den4b (talk | contribs) (Created page with 'Separate capitalized words with spaces. Useful for cleaning up some files downloaded from the internet. For example, if we have a file "''TheEverlyBrothers - AllIHaveToDoIsDream...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Separate capitalized words with spaces. Useful for cleaning up some files downloaded from the internet.

For example, if we have a file "TheEverlyBrothers - AllIHaveToDoIsDream.mp3" it will be converted into "The Everly Brothers - All I Have To Do Is Dream.mp3".

Tested

  • ReNamer 5.20
  • ReNamer 5.50

Code

Author: Denis Kozlov. Date: 14 Sep 2008.

var
  I: Integer;
begin
  for I := WideLength(FileName) downto 2 do        // for each character
    if IsWideCharAlpha(FileName[i]) then           // is alphabetic
      if IsWideCharUpper(FileName[i]) then         // is upper case
        if not IsWideCharSpace(FileName[i-1]) then // is space preceding
          WideInsert(' ', FileName, I);            // insert space
end.