procedure ReplaceMany(var sTr: String; aR: array of String);
{
Calling example:
~~~~~~~~~~~~~~~~~~~
ReplaceMany(Template, ['?VERSION?' (* i.e. cell [0==>1] *), GetOriginalProjectVersion
,'?EXECUTABLE?' (* i.e. cell [2==>3] *), GetExecutableFilenameRelative
,'?PROJECT?' (* i.e. cell [4==>5] *), GetProjectInformationFilenameRelative
,'?TEMPFOLDER?' (* i.e. cell [6==>7] *), GetTempPathAbsolute
,'?CP?' (* i.e. cell [8==>9] *), GetCopyCommand
]);
}
var
i, j: Integer;
begin
{ for half of a 2-dim. table, i.e. for each line i.e. each [index == >value] }
for i := 0 to High(aR) div 2 do begin
j := i shl 1;{== i * 2}
if Trim(aR[j+1]) = '' then
raise Exception.Create('procedure ReplaceMany ==> the placeholder ' + aR[j] + ' is empty!' + LF + 'Please, set a value.');
sTr := StringReplace(sTr, aR[j]{placeholder}, aR[j+1]{value}, [rfReplaceAll]);
end;
end;