arrayIntersect – Talk

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Text replacement - " <!-- (DIS)?CONTINUE Notes -->" to "")
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:


<!-- CONTINUE Notes -->
<dl class="command_description">
<dl class="command_description">
<dt></dt>
<dd class="notedate">Posted on December 11, 2018 - 18:09 (UTC)</dd>
<dd class="notedate">Posted on December 11, 2018 - 18:09 (UTC)</dd>
<dt class="note">[[User:Pierre MGI|Pierre MGI]]</dt>
<dt class="note">[[User:Pierre MGI|Pierre MGI]]</dt>
Line 11: Line 11:
_secondArray = [1,"b",0,"a"];<br>
_secondArray = [1,"b",0,"a"];<br>
_areEquivalent = _firstArray isEqualTo (_secondArray arrayIntersect _firstArray) // returns true
_areEquivalent = _firstArray isEqualTo (_secondArray arrayIntersect _firstArray) // returns true
Note: _areEquivalent can return true, in some cases, even if the arrays haven't the same size. So, compare sizes before contents.
</dd>
</dd>
</dl>
</dl>
<!-- DISCONTINUE Notes -->

Latest revision as of 00:53, 6 April 2021

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 Note: _areEquivalent can return true, in some cases, even if the arrays haven't the same size. So, compare sizes before contents.