Script : Replace (") by (') in All Text Fields

If you made a script you can offer it to the others here, or ask help to improve it. You can also report here bugs & problems with existing scripts.
Post Reply
Sdch
Posts: 4
Joined: 2002-09-29 21:16:38
Location: Belgium

Script : Replace (") by (') in All Text Fields

Post by Sdch »

[UK]
If you have double quotation marks in your base of gives (which causes error with new the template of Twink for example :wink: ) you can automatically change them into simple quotation mark with this script.

rem : Backup you Data Base before by security :hihi:

[FR]
Si vous avez des double guillemets dans votre base de donne (se qui cause des erreur avec le nouveau template de Twink par exemple) vous pouvez les changer en simple guillemet automatiquement avec ce script.

PS : Faite quand meme une copie de votre Base de donnee avant par securiter :hihi:

Sdch

Code: Select all

// SCRIPTING
// Replace (") by (') in All Text Fields
// rem :!The double quotation mark disturbs some template!
//
// Remplace les ["] par des ['] dans tout les champs text
// PS: !Les double guillemet perturbe certain template!

program ReplaceQuotes;
const
  OldValue = '"';
  NewValue = '''';
procedure replace (Field : integer);
begin
  if Pos(OldValue, GetField(Field)) > 0 then
      SetField(Field, StringReplace(GetField(Field), OldValue, NewValue));
end;
begin
// All text field
  replace (fieldDescription);
  replace (fieldComments);
  replace (fieldMedia);
  replace (fieldMediaType);
  replace (fieldSource);
  replace (fieldBorrower);
  replace (fieldOriginalTitle);
  replace (fieldTranslatedTitle);
  replace (fieldDirector);
  replace (fieldProducer);
  replace (fieldCountry);
  replace (fieldCategory);
  replace (fieldActors);
  replace (fieldURL);
  replace (fieldDescription);
  replace (fieldComments);
  replace (fieldVideoFormat);
  replace (fieldAudioFormat);
  replace (fieldResolution);
  replace (fieldFrameRate);
  replace (fieldLanguages);
  replace (fieldSubtitles);
  replace (fieldSize);
(*  not text field
//	fieldNumber
//	fieldDate
//	fieldRating
//	fieldYear
//	fieldLength
//	fieldVideoBitrate
//	fieldAudioBitrate
//	fieldDisks
*)
end.
Twink
Posts: 92
Joined: 2002-08-01 01:40:12

Post by Twink »

sweet. I was feeling too lazy to do such a good job =) thanks. I didn't realise you could set NewValue = ''''; thought u had to use chr(39); dunno. good work neways
antp
Site Admin
Posts: 9630
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

That's nice :cool:
Post Reply