arrayIntersect – Talk

From Bohemia Interactive Community
Jump to navigation Jump to search
(Created page with " <!-- CONTINUE Notes --> <dl class="command_description"> <dd class="notedate">Posted on December 11, 2018 - 18:09 (UTC)</dd> <dt class="note">Pierre MGI</...")
 
No edit summary
Line 10: Line 10:
_fistArray = ["a","b",0,1];<br>
_fistArray = ["a","b",0,1];<br>
_secondArray = [1,"b",0,"a"];<br>
_secondArray = [1,"b",0,"a"];<br>
_areEquivalent = ["a","b",0,1] isEqualTo ([1,"b",0,"a"] arrayIntersect ["a","b",0,1]) // returns true
_areEquivalent = _firstArray isEqualTo (_secondArray arrayIntersect _firstArray) // returns true
</dd>
</dd>
</dl>
</dl>
<!-- DISCONTINUE Notes -->
<!-- DISCONTINUE Notes -->

Revision as of 20:15, 11 December 2018

Posted on December 11, 2018 - 18:09 (UTC)
Pierre MGI
useful to compare two arrays with same (single) elements but in different order:
_areEquivalent = _firstArray isEqualTo (_secondArray arrayIntersect _firstArray);
example:
_fistArray = ["a","b",0,1];
_secondArray = [1,"b",0,"a"];
_areEquivalent = _firstArray isEqualTo (_secondArray arrayIntersect _firstArray) // returns true