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

splice()

Examples
String[] sa1 = { "OH", "NY", "CA" };
sa1 = splice(sa1, "KY", 1);
println(sa1);  // Prints OH, KY, NY, CA
println();

String[] sa2 = { "VA", "CO", "IL" };
sa1 = splice(sa1, sa2, 2);
println(sa1);  // Prints OH, KY, VA, CO, IL, NY, CA
Description Inserts a value or array of values into an existing array. The first two parameters must be of the same datatype. The array parameter defines the array which will be modified and the second parameter defines the data which will be inserted.

When using an array of objects, the data returned from the function must be cast to the object array's data type. For example: SomeClass[] items = (SomeClass[]) splice(array1, array2, index).
Syntax
splice(array, value, index)
splice(array, array2, index)
Parameters
array boolean[], byte[], char[], int[], float[], String[], or an array of objects
value boolean, byte, char, int, float, String, or other Object: value to be spliced in
array2 boolean[], byte[], char[], int[], float[], String[], or an array of objects to be spliced in
index int: position in the array from which to insert data
Usage Web & Application
Related contract()
subset()
Updated on February 09, 2008 04:38:53pm PST

Creative Commons License