代码
//去掉一些代码,以及全角符号
procedure TForm1.Button1Click(Sender: TObject);
var
s:string;
i,j,k:Integer;
begin
with qry do
begin
first;
while not eof do
begin
Edit;
s:=fieldbyname('bmc').AsString;
s:=StringReplace(s,'(','(', [rfIgnoreCase]);
s:=StringReplace(s,')',')', [rfIgnoreCase]);
fieldbyname('bmc').AsString:=s;
s:=fieldbyname('bmc').AsString;
i:=Pos('10442',s);
j:= Pos('(',s);
k:=Pos(')',s);
if i=0 then
begin
Next;
Continue;
end
else
begin
s:=Copy(s,1,i-1);
fieldbyname('bmc').AsString:=s;
if (j<>0) and (k=0) then
fieldbyname('bmc').AsString:= fieldbyname('bmc').AsString+')' ;
end;
Next;
end;
edit;
Post;
close;
open;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
s:string;
i,j,k:Integer;
begin
with qry do
begin
first;
while not eof do
begin
Edit;
s:=fieldbyname('bmc').AsString;
s:=StringReplace(s,'(','(', [rfIgnoreCase]);
s:=StringReplace(s,')',')', [rfIgnoreCase]);
fieldbyname('bmc').AsString:=s;
s:=fieldbyname('bmc').AsString;
i:=Pos('10442',s);
j:= Pos('(',s);
k:=Pos(')',s);
if i=0 then
begin
Next;
Continue;
end
else
begin
s:=Copy(s,1,i-1);
fieldbyname('bmc').AsString:=s;
if (j<>0) and (k=0) then
fieldbyname('bmc').AsString:= fieldbyname('bmc').AsString+')' ;
end;
Next;
end;
edit;
Post;
close;
open;
end;
end;