ArrayDelete (open)
Returns an array with all elements in 'toremove' deleted from 'list'
Syntax
LOADLIB "wh::util/algorithms.whlib";
VARIANT FUNCTION ArrayDelete(VARIANT list, VARIANT toremove)
Parameters
VARIANT list
The first array to use in the comparison
VARIANT toremove
The second array to use in the comparison
Return value
VARIANT
The 'list' array with all values from 'toremove' deleted
Description
Searches for values in the second array that are not present in the first array and returns the an array containing all differences found. When all entries match, an empty array of the type given is returned. Arrays must be of the same type.
Examples
STRING ARRAY alpha := [ "foo", "bar", "baz", "test", "alpha", "beta", "charlie" ];
STRING ARRAY bravo := [ "delta", "echo", "foxtrot", "baz", "bar", "golf", "hotel" ];
STRING ARRAY charlie := [ "foo1", "bar1", "baz1", "test1", "alpha1", "beta1", "charlie1" ];
STRING ARRAY delta := [ "foo", "bar", "baz", "test", "alpha", "beta", "charlie" ];
// returns ["foo", "test", "alpha", "beta", "charlie"]
STRING ARRAY matches1 := ArrayDelete(alpha, bravo);
// returns ["foo", "bar", "baz", "test", "alpha", "beta", "charlie"]
STRING ARRAY matches2 := ArrayDelete(alpha, charlie);
// returns DEFAULT STRING ARRAY
STRING ARRAY matches3 := ArrayDelete(alpha, delta);