BIS fnc consolidateArray: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (GVI released sooner than 1.00, added 0.76. Source http://dev.arma3.com/post/spotrep-00009)
m (Some wiki formatting)
 
(31 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{RV|type=function


{{Function|= Comments
|game1= arma3
____________________________________________________________________________________________
|version1= 0.76


| arma3 |= Game name
|gr1= Arrays


|0.76|= Game version
|descr= Finds duplicates in the given array of anything and consolidates them into an array of sub-arrays
____________________________________________________________________________________________


| <pre>/*
|s1= array call [[BIS_fnc_consolidateArray]]


Description:
|p1= array: [[Array]] - array of anything
Finds duplicities in array of strings and consolidates it to the array of sub-arrays, where:
id 0: string
id 1: occurrence count


Syntax:
|r1= [[Array]] - array of sub-arrays in format [<nowiki/>[value, count],...], where:
_cosolidated:array = _strings:array call BIS_fnc_consolidateArray;
* value: [[Anything]] - consolidated element
* count: [[Number]] - occurrence count


Example:
|x1= <sqf>["apple","apple","pear","pear","apple"] call BIS_fnc_consolidateArray; // return: [["apple",3],["pear",2]]</sqf>
[["apple",3],["pear",2]] = ["apple","apple","pear","pear","apple"] call BIS_fnc_consolidateArray;
*/


</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
|x2= <sqf>["apple","apple",1,1,nil,nil] call BIS_fnc_consolidateArray; // return: [["apple",2],[1,2],[any,2]]</sqf>
____________________________________________________________________________________________
 
| <!-- [] call [[BIS_fnc_consolidateArray]]; --> |= Syntax
 
|p1= |= Parameter 1
 
| |= Return value
____________________________________________________________________________________________
 
|x1= <code></code> |=
____________________________________________________________________________________________
 
| |= See also


|seealso=
}}
}}
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Function Group: Arrays|{{uc:consolidateArray}}]]
[[Category:Functions|{{uc:consolidateArray}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:consolidateArray}}]]

Latest revision as of 13:58, 13 July 2022

Hover & click on the images for description

Description

Description:
Finds duplicates in the given array of anything and consolidates them into an array of sub-arrays
Execution:
call
Groups:
Arrays

Syntax

Syntax:
array call BIS_fnc_consolidateArray
Parameters:
array: Array - array of anything
Return Value:
Array - array of sub-arrays in format [[value, count],...], where:
  • value: Anything - consolidated element
  • count: Number - occurrence count

Examples

Example 1:
["apple","apple","pear","pear","apple"] call BIS_fnc_consolidateArray; // return: [["apple",3],["pear",2]]
Example 2:
["apple","apple",1,1,nil,nil] call BIS_fnc_consolidateArray; // return: [["apple",2],[1,2],[any,2]]

Additional Information

See also:
See also needed

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