here is a quick and dirty example
type
TConstArray = array of TVarRec;
function ToArrayOfConst(aList:TStringList):TConstArray;
begin
SetLength(Result,aList.Count);
for vCntr := 0 to aList.Count-1 do begin
Result[vCntr].VType := vtAnsiString;
Result[vCntr].VAnsiString := @aList[vCntr];
end;
end;
function FormatString(const aFormat:string; aList:TStringList);
var
vValues:TConstArray;
begin
vValues := ToArrayOfConst(aList);
Result := Format(aFormat, vValues);
SetLength(vValues, 0);
end;
Example of use.
your users set their string in the ini as %0:S %1:S %2:S, %0:S, %1:S and then
var
MValueList :TStringList;
begin
MyValueList := TStringList.Create;
try
MyValueList.Add('Value 1');
MyValueList.Add('Value 2');
MyValueList.Add('Value 3');
MyValueList.Add('Value 4');
MyValueList.Add('Value 5');
MyValueList.Add('Value 6');
MyValueList.Add('Value 7');
MyValueList.Add('Value 8');
MyValueList.Add('Value 9');
WriteLn(FormatString(<ReadFormatFromIni>, MyValueList));
finally
myvaluelist.free;
end;
<ReadFormatFromIni> can be any process you see fit.
Let me repeat my self. Everything has been typed directly in the browser. You need to test it to make sure it works its just a skeleton to get you going.