delphi查找并替换字符串

字体大小: 中小 标准 ->行高大小: 标准
procedure ReplaceTextA(var SText: string; TextFind, TextReplace: string);
var
  S: string;
  SLen: LongInt;
  SPos: Integer;
begin
  S := '';
  SLen := Length(TextFind);
  SPos := Pos(TextFind, SText);
  while SPos > 0 do
  begin
    S := S + Copy(SText, 1, SPos - 1) + TextReplace;
    Delete(SText, 1, SPos + SLen - 1);
    SPos := Pos(TextFind, SText);
  end;
  S := S + SText;
  SText := S;
end;

此文章由 http://www.ositren.com 收集整理 ,地址为: http://www.ositren.com/htmls/67967.html