PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Copying arrays of different dimensions
  • Various
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Copies the content of an array or associative array into another one.
Note: This function can only be used on the WLanguage arrays.
Versions 15 and later
Android This function is now available for the Android applications.
New in version 15
Android This function is now available for the Android applications.
Android This function is now available for the Android applications.
Versions 16 and later
Universal Windows 10 App This function is now available for the Windows Phone applications.
New in version 16
Universal Windows 10 App This function is now available for the Windows Phone applications.
Universal Windows 10 App This function is now available for the Windows Phone applications.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Versions 21 and later
Apple Watch This function is now available in Apple Watch mode.
WEBDEV - Browser code This function is now available in browser code.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Apple Watch This function is now available in Apple Watch mode.
WEBDEV - Browser code This function is now available in browser code.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Apple Watch This function is now available in Apple Watch mode.
WEBDEV - Browser code This function is now available in browser code.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Example
MyArray is array of 2 strings
MyArray[1] = "WINDEV"
MyArray[2] = "WEBDEV"
MyArrayCopy is array of 2 strings
ArrayCopy(MyArray, MyCopiedArray)
Versions 18 and later
arrA1 is array of int = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
// Copy the first 3 elements from arrA1 to arrA2
arrA2 is array of int
ArrayCopy(arrA1, arrA2, 1, 3) // [1, 2, 3]
// Copy 4 integers from position 4
arrA3 is array of int
ArrayCopy(arrA1, arrA3, 4, 4) // [5, 6, 7, 8]
// Copy the end of array from position 6
arrA4 is array of int
ArrayCopy(arrA1, arrA4, 6) // [7, 8, 9, 10]
New in version 18
arrA1 is array of int = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
// Copy the first 3 elements from arrA1 to arrA2
arrA2 is array of int
ArrayCopy(arrA1, arrA2, 1, 3) // [1, 2, 3]
// Copy 4 integers from position 4
arrA3 is array of int
ArrayCopy(arrA1, arrA3, 4, 4) // [5, 6, 7, 8]
// Copy the end of array from position 6
arrA4 is array of int
ArrayCopy(arrA1, arrA4, 6) // [7, 8, 9, 10]
arrA1 is array of int = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
// Copy the first 3 elements from arrA1 to arrA2
arrA2 is array of int
ArrayCopy(arrA1, arrA2, 1, 3) // [1, 2, 3]
// Copy 4 integers from position 4
arrA3 is array of int
ArrayCopy(arrA1, arrA3, 4, 4) // [5, 6, 7, 8]
// Copy the end of array from position 6
arrA4 is array of int
ArrayCopy(arrA1, arrA4, 6) // [7, 8, 9, 10]
Syntax
ArrayCopy(<Name of Source Array> , <Name of Destination Array> [, <Start Position of Copy> [, <Size of Copy>]])
<Name of Source Array>: Array
Name of the Array variable to copy.
<Name of Destination Array>: Array
Name of the Array variable into which the copy must be performed.
<Start Position of Copy>: Optional integer
Versions 18 and later
Subscript in the source array from which the copy must be performed. This subscript must be included between 1 and the last array subcript.
This parameter is set to 1 by default. Otherwise, a WLanguage error occurs at run time.
This parameter cannot be used with an associative array.
PHP This parameter is not available.
New in version 18
Subscript in the source array from which the copy must be performed. This subscript must be included between 1 and the last array subcript.
This parameter is set to 1 by default. Otherwise, a WLanguage error occurs at run time.
This parameter cannot be used with an associative array.
PHP This parameter is not available.
Subscript in the source array from which the copy must be performed. This subscript must be included between 1 and the last array subcript.
This parameter is set to 1 by default. Otherwise, a WLanguage error occurs at run time.
This parameter cannot be used with an associative array.
PHP This parameter is not available.
<Size of Copy>: Optional integer
Versions 18 and later
Size of the copy.
Caution: The interval of values defined by <Start Position of Copy> and <Size of Copy< must be entirely included in the source array. Otherwise, a WLanguage error occurs at run time.
By default, the copy is performed from the specified subscript to the end of the array.
This parameter cannot be used with an associative array.
PHP This parameter is not available.
New in version 18
Size of the copy.
Caution: The interval of values defined by <Start Position of Copy> and <Size of Copy< must be entirely included in the source array. Otherwise, a WLanguage error occurs at run time.
By default, the copy is performed from the specified subscript to the end of the array.
This parameter cannot be used with an associative array.
PHP This parameter is not available.
Size of the copy.
Caution: The interval of values defined by <Start Position of Copy> and <Size of Copy< must be entirely included in the source array. Otherwise, a WLanguage error occurs at run time.
By default, the copy is performed from the specified subscript to the end of the array.
This parameter cannot be used with an associative array.
PHP This parameter is not available.
Remarks

Copying arrays of different dimensions

  • Simple array: A WLanguage error occurs at run time.
  • Dynamic array: The destination array is entirely re-allocated (and therefore cleared) with the copy.

Various

  • A WLanguage error occurs if the type of the elements found in the destination array differs from the type of the elements found the source array.
  • If the destination array contains elements, these elements are freed.
  • This function can be used with associative arrays.
  • This function cannot be used with the fixed arrays.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230vm.dll
Windows Mobile wp230vm.dll
WEBDEV - Browser code WDJS.DLL
Java wd230java.jar
Linux wd230vm.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Check the results of the examples
arrA1 is array of int = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
// Copy the first 3 elements from arrA1 to arrA2
arrA2 is array of int
ArrayCopy(arrA1, arrA2, 1, 3) // [1, 2, 3]
// Copy 4 integers from position 4
arrA3 is array of int
ArrayCopy(arrA1, arrA3, 4, 4) // [4,5, 6, 7]
// Copy the end of array from position 6
arrA4 is array of int
ArrayCopy(arrA1, arrA4, 6) // [6, 7, 8, 9, 10]
Mister FERNANDO
Nov. 11 2016