Name
Copy Function
Syntax
function Copy(Source: string; StartingIndex, Count: Integer): string; function Copy(Source: array; StartingIndex, Count: Integer): array;
Description
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.
Tips and Tricks
If
StartingIndexis less than zero or past the end ofSource, the result is an empty string or array.The length of the new string or array is
Countunless theSourcehas fewer thanCountelements to copy, in which caseCopycopies 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
Sourcefrom the starting index is to useMaxIntas theCount.
See Also
| Delete Function, High Function, Insert Procedure, Length Function, Low Function, SetLength Procedure, SetString Procedure, Slice Function |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access