function FormatString(Format : string; Args : array of Variant): string;
var
iNoArgs : integer;
begin
for iNoArgs := 0 to High(Args) do
Format := StringReplace(Format, '{' + IntToStr(iNoArgs) + '}', Args[iNoArgs], [rfReplaceAll, rfIgnoreCase]);
Result := Format;
end;
// Exemple d'utilisation :
ShowMessage(FormatString('Bonjour {0}, tu vas {1} ? On est le {2} aujourd''hui', ['toi', 'bien', Date]));
// Affichera 'Bonjour toi, tu vas bien ? On est le 9/18/2007 aujourd'hui'