Search processing.org:

Reference for Processing version 1.0+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.

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

Updated on November 22, 2008 08:39:25pm PST