unit UReplace;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
function MakeArrayOutOfDigit(Position, Length: Integer; Str:
String):
String;
function Replace(
var Pos: Integer; Zeile:
String):
String;
implementation
uses UMain;
function MakeArrayOutOfDigit(Position, Length: Integer; Str:
String):
String;
var
i: Integer;
begin
Result := '
';
for i := Position
to (Position + Length)
do
Result := Result + Str[i];
end;
function Replace(
var Pos: Integer; Zeile:
String):
String;
var
iKey: Integer;
Replaced: Boolean;
begin
Replaced := False;
for iKey := 0
to (Form1.KeyList.Count - 1)
do
begin
if (MakeArrayOutOfDigit(Pos, Length(Form1.KeyList[iKey]), Zeile) =
Form1.KeyList[iKey])
then
begin
Result := Form1.ClassKey +
MakeArrayOutOfDigit(Pos, Length(Form1.KeyList[iKey]), Zeile) +
Form1.ClassEnd;
inc(Pos, Length(Form1.KeyList[iKey]));
Replaced := True;
end;
end;
if not Replaced
then
begin
Result := PChar(Zeile[Pos]);
inc(Pos);
end;
end;
end.