我是这样作的:
function quan_b(str: AnsiString;p:TProgressBar): AnsiString;
var
str0,str1,str2:AnsiString;
Flags: TReplaceFlags;
n:Integer;
const
strcn='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`1234567890-=\~!#$%^&()_+|[]{};':",。/<>?';
stren='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`1234567890-=/~!#$%^&()_+|[]{};'':",./<>?';
begin
str0:=str;
for n:=1 to 95 do
begin
str1:=copy(strcn,2*n-1,2);
str2:=copy(stren,n,1);
Flags:=[rfReplaceAll];
str0:=StringReplace(str0,str1,str2,Flags);
end;
quan_b:=str0;
end;