11.9 delete()

This function can be used to delete one or more values from a collection (data types hash, list, matrix, refvec and vector) at a given position. The subsequent values are shifted forward. The data type string is also supported to remove characters from a string.

The values are deleted at the specified position. The position must be >= 1, i.e. it is not possible to delete default values at the indices [0] or [0,0] with this function. The largest possible position is the current countof(ListValue).

The number of values to be deleted is determined by the Count parameter and should be >= 0.

In case of an error, the function call is aborted with a fail.

Also considered an error is the attempt to delete more values respectively rows or columns than actually exist.

Definition

anyalue delete
(
      anyvalue ListValue input
      integer  Pos   input
  { , integer  Count := 1 input }
  { , enum     Dir   := dir_row input }
)

Parameters

anyvalue ListValue input
This parameter specifies the collection or string where values shall be deleted.
integer Pos input
In this parameter, the index position is defined at which inclusively deleting begins. Values >= 1 are permitted. For matrix collections, depending on the Dir parameter, Pos represents either a row position (dir_row) or a column position (dir_column).
integer Count := 1 input
This optional parameter indicates the number of values (respectively rows or columns for a matrix) to be deleted. Values >= 0 are allowed, with no deleting being performed for 0. The number should not exceed the possible position range when deleting.
enum Dir := dir_row input
This optional parameter defines the orientation of the index position, which is important for a matrix. The default value dir_row means that rows are deleted in the matrix. With dir_column columns are deleted.

Return value

The function returns the modified collection respectively the modified string.

Particularities

Examples

Availability

Since IDM version A.06.02.g

See also

Built-in function insert()