Files
processing4/mobile/web/reference/API/splice.xml
2005-01-27 06:48:42 +00:00

72 lines
1.6 KiB
XML

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
<name>splice()</name>
<category>Data</category>
<subcategory>Array Functions</subcategory>
<usage>Web &amp; Application</usage>
<example>
<image></image>
<code>
String sa1[] = { "OH ", "NY ", "CA "};
sa1 = splice(sa1, "KY ", 1);
print(sa1); // Prints "OH KY NY CA "
println();
String sa2[] = { "VA ", "CO ", "IL " };
sa1 = splice(sa1, sa2, 2);
print(sa1); // Prints "OH KY VA CO IL NY CA "
</code>
</example>
<description>
Inserts a value or array of values into an existing array. The first two parameters must be of the same datatype. The <b>array</b> parameter defines the array which will be modified and the second parameter defines the data which will be inserted.
</description>
<syntax>
splice(<c>array</c>, <c>value</c>, <c>index</c>)
splice(<c>array</c>, <c>array2</c>, <c>index</c>)
</syntax>
<parameter>
<label>array</label>
<description>booleans[], bytes[], chars[], ints[], floats[], or Strings[]: base array</description>
</parameter>
<parameter>
<label>value</label>
<description>booleans, bytes, chars, ints, floats, or Strings: value to be spliced in</description>
</parameter>
<parameter>
<label>array2</label>
<description>booleans[], bytes[], chars[], ints[], floats[], Strings[]: array to be spliced in</description>
</parameter>
<parameter>
<label>index</label>
<description>int: position in the array from which to insert data</description>
</parameter>
<returns>Array (the same datatype as the input)</returns>
<related>
contract()
slice()
</related>
<availability>1.0</availability>
<type>Function</type>
<partof>Core</partof>
<level>Extended</level>
</root>