Is there a simple way in delphi to convert an array of strings to a tstringlist?
Once you have created the string list, you can simply call AddStrings()
.
Or for older versions of Delphi that do not support the AddStrings()
overloads that accept arrays, you can roll your own.
function StringListFromStrings(const Strings: array of string): TStringList;
var
i: Integer;
begin
Result := TStringList.Create;
for i := low(Strings) to high(Strings) do
Result.Add(Strings[i]);
end;
Using an open array parameter affords the maximum flexibility for the caller.