a port of the Processing Visualization Language
Name

arrayCopy()

Examples
String[] north = { "OH", "IN", "MI"};
String[] south = { "GA", "FL", "NC"}; 
arrayCopy(north, south);
print(south);  // Prints OH, IN, MI

String[] north = { "OH", "IN", "MI"};
String[] south = { "GA", "FL", "NC"}; 
arrayCopy(north, 1, south, 0, 2);
println(south);  // Prints IN, MI, NC
Description

Copies an array (or part of an array) to another array. The src array is copied to the dst array, beginning at the position specified by srcPos and into the position specified by dstPos. The number of elements to copy is determined by length. The simplified version with two arguments copies an entire array to another of the same size. It is equivalent to "arrayCopy(src, 0, dst, 0, src.length)". This function is far more efficient for copying array data than iterating through a for and copying each element.

Syntax
arrayCopy(src,dest)

arrayCopy(src,dest,length)
arrayCopy(src,srcPos,dest,destPos,length)
Parameters
src an array of any data type: the source array
dest an array of any data type (as long as it's the same as src): the destination array
srcPos int: starting position in the source array
destPos int: starting position in the destination array
length int: number of array elements to be copied
Returns None
Usage Web & Application

This reference is licensed under the CC BY-NC-SA 2.0 license:

Creative Commons License
Fork me on GitHub