ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Queue, stack, list and array functions / Array functions
  • Copying arrays of different dimensions
  • Miscellaneous
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Copies the content of a WLanguage array or associative array to another one.
Note: This function can only be used on WLanguage arrays.
Example
MonTableau is array of 2 strings
MonTableau[1] = "WINDEV"
MonTableau[2] = "WEBDEV"
MonTableauCopie is array of 2 strings
MonTableau.Copy(MonTableauCopie)
tabT1 is array of int 
tabT1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
// On copie les 3 premiers éléments de tabT1 dans tabT2
tabT2 is array of int
tabT1.Copy(tabT2, 1, 3)	// [1, 2, 3]
// On copie 4 entiers à partir de la position 4
tabT3 is array of int
tabT1.Copy(tabT3, 4, 4)	// [4, 5, 6, 7]
// On copie la fin du tableau à partir de la position 6
tabT4 is array of int
tabT1.Copy(tabT4, 6)		// [6, 7, 8, 9, 10]
Syntax
<Source array>.Copy(<Destination array> [, <Start position of copy> [, <Copy size>]])
<Source array>: Array
Name of the Array variable to copy.
<Destination array>: Array
Name of the Array variable into which the copy must be performed.
<Start position of copy>: Optional integer
Index in the source array where the copy must start. This index must be between 1 and the last index of the array.
This parameter is set to 1 by default. Otherwise, a WLanguage error occurs at runtime.
This parameter cannot be used with an associative array.
AndroidAndroid Widget JavaPHP This parameter is not available.
<Copy size>: Optional integer
Copy size.
Warning: The range of values indicated by <Position de début de copie> and <Taille de copie> must be entirely included in the source array. Otherwise, a WLanguage error occurs at runtime.
By default, elements are copied from the specified index to the end of the array.
This parameter cannot be used with an associative array.
AndroidAndroid Widget JavaPHP This parameter is not available.
Remarks

Copying arrays of different dimensions

  • Simple array: A WLanguage error is generated at runtime.
  • Dynamic array: The destination array is completely re-allocated (and therefore emptied) with the copy.

Miscellaneous

  • 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 deleted.
  • This function can be used with associative arrays. In this case, it is only possible to copy the entire array. It is not possible to copy part of the associative array.
  • This function cannot be used with the fixed arrays.
Component: wd300vm.dll
Minimum version required
  • Version 23
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/24/2024

Send a report | Local help