BIS fnc numberDigits: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (1 revision)
m (Text replacement - "(\|[pr][0-9]+ *= *[^- ]*) *- *N([a-z ])" to "$1 - n$2")
 
(39 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{RV|type=function


{{Function|= Comments
|game1= tkoh
____________________________________________________________________________________________
|version1= 1.00


| tkoh |= Game name
|game2= arma3
|version2= 0.50


|1.00|= Game version
|gr1= Arrays
____________________________________________________________________________________________


| <pre>/*
|gr2= Strings


Description:
|descr= Break number into array of digits.
Break number into array of digits


Example:
|s1= number call [[BIS_fnc_numberDigits]]
123456 > [1,2,3,4,5,6]


Parameter(s):
|p1= number: [[Number]] - number that should be broken down. A float will be '''truncated''', not rounded
_this: NUMBER


Returns:
|r1= [[Array]] of [[Number]]s - array of ''number'' digits
ARRAY
*/
</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_numberDigits]]; --> |= Syntax
|x1= <sqf>12345678 call BIS_fnc_numberDigits; // returns [1,2,3,4,5,6,7,8]</sqf>


|p1= |= Parameter 1
|x2= <sqf>123.9999 call BIS_fnc_numberDigits; // returns [1,2,3]</sqf>
 
| |= Return value
____________________________________________________________________________________________
 
|x1= <code></code> |=
____________________________________________________________________________________________
 
| |= See also


|seealso= [[BIS_fnc_numberText]] [[BIS_fnc_cutDecimals]]
}}
}}
|


<h3 style="display:none">Notes</h3>
<dl class="command_description">
<dl class="command_description">
<!-- Note Section BEGIN -->


<!-- Note Section END -->
<dt></dt>
<dd class="notedate">Posted on 2018-03-20 - 21:25 (UTC)</dd>
<dt class="note">[[User:vabene1111|vabene1111]]</dt>
<dd class="note">
Use this function with caution: Numbers with more than 8 digits will return wrong results
<sqf>[11111111]      call BIS_fnc_numberDigits; // returns [1,1,1,1,1,1,1,1]
[111111111]    call BIS_fnc_numberDigits; // returns [1,1,1,1,1,1,1,1,2]
[1111111111111] call BIS_fnc_numberDigits; // returns [1,1,1,1,1,1,1,1,0,6,5,6,0]</sqf>
 
</dl>
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Function Group: Numbers|{{uc:numberDigits}}]]
[[Category:Functions|{{uc:numberDigits}}]]
[[Category:{{Name|tkoh}}: Functions|{{uc:numberDigits}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:numberDigits}}]]

Latest revision as of 15:39, 8 November 2023

Hover & click on the images for description

Description

Description:
Break number into array of digits.
Execution:
call
Groups:
ArraysStrings

Syntax

Syntax:
number call BIS_fnc_numberDigits
Parameters:
number: Number - number that should be broken down. A float will be truncated, not rounded
Return Value:
Array of Numbers - array of number digits

Examples

Example 1:
12345678 call BIS_fnc_numberDigits; // returns [1,2,3,4,5,6,7,8]
Example 2:
123.9999 call BIS_fnc_numberDigits; // returns [1,2,3]

Additional Information

See also:
BIS_fnc_numberText BIS_fnc_cutDecimals

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

|

Posted on 2018-03-20 - 21:25 (UTC)
vabene1111
Use this function with caution: Numbers with more than 8 digits will return wrong results
[11111111] call BIS_fnc_numberDigits; // returns [1,1,1,1,1,1,1,1] [111111111] call BIS_fnc_numberDigits; // returns [1,1,1,1,1,1,1,1,2] [1111111111111] call BIS_fnc_numberDigits; // returns [1,1,1,1,1,1,1,1,0,6,5,6,0]