
25.02.2011, 13:06
|
 |
Местный
|
|
Регистрация: 04.04.2008
Адрес: Минск
Сообщения: 596
Версия Delphi: 2007 & JAVA EE
Репутация: 10670
|
|
ну типа можно так
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
gg = record
old :string;
new :string;
end;
Tarray= array[1..100] of gg;
var
Form1: TForm1;
implementation
{$R *.dfm}
function StrRepAll(text:string;pattern:Tarray):string;
var i:integer;
begin
for i:=1 to length(pattern) do
text:=StringReplace(text,pattern[i].old,pattern[i].new,[rfReplaceAll]);
Result:=text;
end;
procedure TForm1.Button1Click(Sender: TObject);
var a: Tarray;
test:string;
begin
test:='gdfg-1dfgd-2ffgd-3';
a[1].old:='-1';
a[1].new:='1';
a[2].old:='-2';
a[2].new:='2';
a[3].old:='-3';
a[3].new:='3';
test:=StrRepAll(test,a);
showmessage(test);
end;
end.
__________________
Последний раз редактировалось Admin, Сегодня в 10:32.
|