Help Center

RemoveElementsFromArrayfunction

Removes the specified elements from an array.

String ManagementfunctionAfxArrays.incdoc-orphan
No implementation located. This member is documented, but the source scan found no matching declaration. It is likely declared in a header this scan does not resolve, or provided by a macro.

Parameters

NameDescription
rgThe array.
rgElementsArray of long values indicating the 0-based positions of the elements to remove.

Description

Removes the specified elements of a dynamic one-dimensional array.

Remarks

The array can be of any type.

If the array has a fixed length, GetLastError will return an E_ACCESSDENIED error.

Examples

#macro RemoveElementsFromArray(rg, rgElements)

DIM rg(ANY) AS LONG ' // Fill the array DIM nLong AS LONG = 1 FOR i AS LONG = 1 TO 10 AppendElementToArray(rg, nLong) nLong += 1 NEXT ' Fill the array of elements to delete DIM rgElements(0 TO 3) AS LONG => {2, 4, 6, 8} RemoveElementsFromArray(rg, rgElements) ' // Display the array FOR i AS LONG = LBOUND(rg) TO UBOUND(rg) print rg(i) NEXT

Reference

  • Include file AfxArrays.inc
  • Documented in String Management/Array Macros.md
  • Topic: Array Macros