arrayIntersect: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (template:command argument fix)
Line 8: Line 8:
____________________________________________________________________________________________
____________________________________________________________________________________________


| Intersects array1 with array2 returning array of unique common elements. Additionally, using the same array for array1 and array2 will simply return array of unique elements. Intersects only 1st dimension of an array. |= Description
| Intersects array1 with array2 returning array of unique common elements. Additionally, using the same array for array1 and array2 will simply return array of unique elements. Intersects only 1st dimension of an array. |DESCRIPTION=
____________________________________________________________________________________________
____________________________________________________________________________________________


| array1 '''arrayIntersect''' array2|= Syntax
| array1 '''arrayIntersect''' array2|SYNTAX=


|p1= array1: [[Array]] |= Parameter 1
|p1= array1: [[Array]] |= Parameter 1
Line 17: Line 17:
|p2= array2: [[Array]] |= Parameter 2
|p2= array2: [[Array]] |= Parameter 2


| [[Array]] |= Return value
| [[Array]] |RETURNVALUE=
____________________________________________________________________________________________
____________________________________________________________________________________________
   
   
Line 32: Line 32:
____________________________________________________________________________________________
____________________________________________________________________________________________


| [[append]], [[set]], [[pushBack]], [[pushBackUnique]], [[apply]], [[select]], [[resize]], [[reverse]], [[count]], [[find]], [[in]], [[forEach]], [[deleteAt]], [[deleteRange]], [[sort]], [[param]], [[params]], [[toArray]], [[toString]], [[splitString]], [[joinString]], [[BIS_fnc_arrayPushStack]], [[BIS_fnc_arrayPush]] |= See also
| [[append]], [[set]], [[pushBack]], [[pushBackUnique]], [[apply]], [[select]], [[resize]], [[reverse]], [[count]], [[find]], [[in]], [[forEach]], [[deleteAt]], [[deleteRange]], [[sort]], [[param]], [[params]], [[toArray]], [[toString]], [[splitString]], [[joinString]], [[BIS_fnc_arrayPushStack]], [[BIS_fnc_arrayPush]] |SEEALSO=


}}
}}

Revision as of 12:25, 7 April 2019

Hover & click on the images for description

Description

Description:
Intersects array1 with array2 returning array of unique common elements. Additionally, using the same array for array1 and array2 will simply return array of unique elements. Intersects only 1st dimension of an array.
Groups:
Uncategorised

Syntax

Syntax:
array1 arrayIntersect array2
Parameters:
array1: Array
array2: Array
Return Value:
Array

Examples

Example 1:
_arr1 = [1,2,3,4,5,2,3,4]; _arr2 = [4,5,6,1,2,3,5,6]; hint str (_arr1 arrayIntersect _arr2); // [4,5,1,2,3]
Example 2:
_arr = [1,2,3,1,2,3,1,2,3,4,5]; hint str (_arr arrayIntersect _arr); // [1,2,3,4,5]
Example 3:
Remove nils: hint str ([1,2,nil,3] arrayIntersect [1,2,nil,3]); // [1,2,3]
Example 4:
Also works with array elements which are equal: hint str ([[1],[2],[3]] arrayIntersect [[2],[3],[4]]); // [[2],[3]]

Additional Information

See also:
appendsetpushBackpushBackUniqueapplyselectresizereversecountfindinforEachdeleteAtdeleteRangesortparamparamstoArraytoStringsplitStringjoinStringBIS_fnc_arrayPushStackBIS_fnc_arrayPush

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note