function ReplaceString(var S: string; const Token, NewToken: string; bCaseSensitive: Boolean): Boolean;
var
I : Integer;
sFirstPart: string;
begin
if bCaseSensitive then
I := AnsiPos(Token, S)
else
I := AnsiPos(AnsiUpperCase(Token), AnsiUpperCase(S));
if I <> 0 then
begin
sFirstPart := Copy(S, 1, I - 1) + NewToken; // 磷?礚絘患癹
S := Copy(S, I + Length(Token), Maxint);
end;
Result := I <> 0;
if Result then
begin
ReplaceString(S, Token, NewToken, bCaseSensitive);
S := sFirstPart + S;
end;
end;
procedure Simple_ReplaceString(var S: string; const Substr: string; index, Count: Integer);
begin
S := Format('%s%s%s',[Copy(S, 1, index - 1), Substr, Copy(S, index + Count, Maxint)]);
end;