Escape/replace characters in a string

Addendum:

The whole thing can be packed into a function, like this:

function Escape(Oldstring: string): string;
var
  Newstring, Part: string;
  i: integer;
begin
  Newstring := '';
  for i := 1 to Length(Oldstring) do
    begin
      Part := Copy(Oldstring, i, 1);
      if Part = ':' then
        Part := '\:'
      else if Part = '/' then
        Part := '\/';      
      Newstring := Newstring + Part;
    end;
  Result := Newstring;
end;

This function can be called within the script from which the title string is generated:

var
  Title: string;

function Escape(Oldstring: string): string;
  // (everything from above)

procedure OnPlayerStart(PlaylistIndex: integer; PlayerIndex: integer; Item: IPlaylistItem);
begin
  Title := Escape(Item.GetTitle);
end;

begin
end.


Tidied-up regards

TSD