Copy Function
function Copy(Source: string; StartingIndex, Count: Integer): string; function Copy(Source: array; StartingIndex, Count: Integer): array;
The Copy
function creates a copy of part of a
string or dynamic array. The result is a new string or dynamic array.
The new string or array starts with the element at
StartingIndex
in Source
. The
new string or array contains up to Count
elements.
If Count
exceeds the number of items remaining in
the source string or array, the elements from
StartingIndex
to the end of the string or array
are copied.
Copy
is not a real function.
If StartingIndex
is less than zero or past the end
of Source
, the result is an empty string or array.
The length of the new string or array is Count
unless the Source
has fewer than
Count
elements to copy, in which case
Copy
copies all the elements up to the end of the
string or array.
The first index of a string is 1. The first index of a dynamic array is 0.
A convenient way to copy all the elements of
Source
from the starting index is to use
MaxInt
as the Count
.