delphi 如何批量替换字符

来源:百度知道 编辑:UC知道 时间:2024/05/24 23:34:32
一个字符串中包括了多个以下这样的字符,而且是无序的
我用StringReplace替换比较慢
如何批量替换这些字符(&!@%#$*<>"ABCDETYJHEHDL等字符

//Pacal Code,you can copy code to Delphi;
Program Test;
var
Len,Count:Integer;
Str:String;
begin
Str:='dfecffgrgrsfwerg';
Len:=Length(Str);
For COunt:=1 to Len do
Begin
If (Str[Count]='d') or (str[count]='g') Then //我要替换d和g
//Doing something...
end;
end.