arraydelete(
TEXT
,
ITEM
,
COUNT
,
SEPARATOR
)

The arraydelete( function deletes (removes) one or more elements from a text array or a data array (see Text Arrays and Data Arrays).


Parameters

This function has four parameters:

text – The text array or data array that contains the elements you want to delete.

item – The number of the first array element you want to delete. The first item is 1, the second item is 2, the third is 3, etc., or you can use negative values, -1 (last item), -2 (second to last, etc.)

count – The number of array elements you want to delete.

separator – The separator character or characters for this array. This parameter is omitted if the target array is a data array.


Description

The arraydelete( function removes one or more elements from a Text Array or a Data Array. The output array will be shorter than the input array.

arraydelete("red,green,blue,orange,white",2,1,",") ☞ red,blue,orange,white
arraydelete("red,green,blue,orange,white",3,2,",") ☞ red,green,white
arraydelete("red,green,blue,orange,white",-1,1,",") ☞ red,green,blue,orange

Working with Data Arrays

This function works with both data and text arrays. Because Data Arrays have no separators between elements, the separator parameter is omitted when targeting a data array.

Suppose we have a data array, myDataArray, defined as below (noting that a data array can contain text, numeric, binary and other data types):

myDataArray = dataarray("Bob",123,3.14159,"Green",303)

Then

arraydelete(myDataArray,2,1) ☞ Bob,3.14159,Green,303
arraydelete(myDataArray,3,2) ☞ Bob,123,303
arraydelete(myDataArray,7) ☞ arraydelete( cannot delete outside of array bounds

Commas have been used to separate the elements of the output data arrays. This has been done for clarity of display – remember that data arrays have no separators.


Error Messages

array( function: ARRAY parameter must be text. – The array (first parameter) must be text, not a number.

array( function: ITEM parameter must be numeric. – The item (second parameter) must be a number, not text.

array( function: COUNT parameter must be numeric. – The count (third parameter) must be a number, not text.

array( function: SEPARATOR parameter must be text. – The separator character (fourth parameter) must be text, not a number.


See Also


History

VersionStatusNotes
10.0UpdatedCarried over from Panorama 6.0, but the item number can now be negative to designate that it should be counted from the end of the string instead of from the beginning. More than one character is now allowed for use as the separator parameter.