Search processing.org:

Reference for Processing (BETA) version 0135+. 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
Usage | Web & Application

Updated on November 17, 2007 10:07:52am PST