Page 1 of 1

[REL] Subroutine: The.Mission.[DVD] to The Mission

Posted: 2005-03-07 09:10:47
by ABNormal
I'm trying to make a subroutine to put inside scripts that does this:

from a title like this:
Il.Colore.viola.[XviD-ITA-ENG].avi

changes dots into spaces and removes square brackets with all written inside, having a result like this:

Il Colore viola

Is anyone able to write the/a valid code?

Thank YOU all
ABN

Posted: 2005-03-07 09:55:30
by antp
As I said somewhere else, simply use the functions of StringUtils1:

Code: Select all

program NewScript;

uses
  StringUtils1;

var
  s, s2: string;

begin
  s := StringReplace(GetField(fieldOriginalTitle), '.', ' ');
  s2 := TextBefore(s, '[', '');
  if s2 = '' then
    s2 := s;
  SetField(fieldOriginalTitle, s);
end.

Posted: 2005-03-07 11:33:48
by ScorEpioN
you could use my script "Update Fields" v10 or next v12

Posted: 2005-03-07 12:02:40
by ABNormal
now i have studied this script.

now i'm changing the MovieName definition (into scripts i use) as:

Code: Select all

    MovieName := StringReplace(GetField(fieldTranslatedTitle), '.', ' ');
    if MovieName = '' then
      MovieName := StringReplace(GetField(fieldOriginalTitle), '.', ' ');
While pos ('[', MovieName) > 0 Do begin
  MovieName := TextBefore(MovieName, '[', '') + TextAfter(MovieName, ']');
end;
(adding

Code: Select all

uses
  StringUtils1; 
at the beginning of each script, of course)

solving my little "problem"

i thank you for all your precious helps.
ABN