SCAR Code:
function SetItemsFirst(items, arr: TStringArray): Tstringarray;
var
i, j, k, h, itemLength, arrPos: Integer;
begin
// Initialize all variables.
h := High(arr);
SetLength(Result, h + 1);
k := High(items);
itemLength := k + 1;
for i := 0 to h do
// if the String is in the items array, we add it to the first index available, held by j
if InStrArrEx(arr[i], items, false, arrPos) then
Result[arrPos] := arr[i];
else
// Otherwise, we add it to the array as normal. This will keep the order minus the ones extracted.
begin
Result[k] := arr[i];
Inc(k);
end;
end;
Try that.