You are not logged in.
Pages: 1
I have been using a rather complicated function to concatenate 2 arrays into one. Is it possible to have a built-in function that does this in future releases?
It would be nice to allow '+' to work on TWideStringArray directly so that
Array1 + array2 + ... can be allowed?
Thanks for consideration!
Offline
The current Pascal Script implementation is not capable of overloading the '+' operator to make it work with TWideStringArray or any other custom types.
However, we can add built-in functions to offer this functionality. Keep an eye on the next development version.
Offline
this is what I am using now in my ever-growing includes. Just copying the values as it loops through. Really looking forward to a built-in function!
function concatArrays(const r1, r2:TWideStringArray):TWideStringArray;
var i: Integer;
begin
SetLength(result, length(r1) + Length(r2));
for i := 0 to length(r1)-1 do result[i] := r1[i];
for i := 0 to length(r2)-1 do result[i + length(r1)] := r2[i];
end;
Offline
In v7.5.0.3 Beta several string array management functions were added to Pascal Script.
function WideConcatStringArrays(const A, B: TWideStringArray): TWideStringArray;
function WideCopyStringArray(const Strings: TWideStringArray; Index, Count: Integer): TWideStringArray;
procedure WideAppendStringArray(var Strings: TWideStringArray; const NewString: WideString);
Offline
Pages: 1