ACOPY() Copy elements from one array to another ------------------------------------------------------------------------------ Syntax ACOPY(<aSource>, <aTarget>, [<nStart>], [<nCount>], [<nTargetPos>]) --> aTarget Arguments <aSource> is the array to copy elements from. <aTarget> is the array to copy elements to. <nStart> is the starting element position in the <aSource> array. If not specified, the default value is one. <nCount> is the number of elements to copy from the <aSource> array beginning at the <nStart> position. If <nCount> is not specified, all elements in <aSource> beginning with the starting element are copied. <nTargetPos> is the starting element position in the <aTarget> array to receive elements from <aSource>. If not specified, the default value is one. Returns ACOPY() returns a reference to the target array, <aTarget>. Description ACOPY() is an array function that copies elements from the <aSource> array to the <aTarget> array. The <aTarget> array must already exist and be large enough to hold the copied elements. If the <aSource> array has more elements, some elements will not be copied. ACOPY() copies values of all data types including NIL and code blocks. If an element of the <aSource> array is a subarray, the corresponding element in the <aTarget> array will contain a reference to the subarray. Thus, ACOPY() will not create a complete duplicate of a multidimensional array. To do this, use the ACLONE() function. Examples . This example creates two arrays, each filled with a value. The first two elements from the source array are then copied into the target array: LOCAL nCount := 2, nStart := 1, aOne, aTwo aOne := { 1, 1, 1 } aTwo := { 2, 2, 2 } ACOPY(aOne, aTwo, nStart, nCount) // Result: aTwo is now { 1, 1, 2 } Files Library is CLIPPER.LIB.
See Also: ACLONE() ADEL() AEVAL() AFILL() AINS() ASORT()