BIS fnc numberDigits: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\{\{ *codecomment *\| *\/\/ *([^ ]+) *\}\} " to "{{cc|$1}}")
m (revert + fix)
Line 1: Line 1:
{{RV|type=function
{{RV|type=function


| tkoh
|game1= tkoh


|1.00
|version1= 1.00


|gr1 = Arrays
|gr1= Arrays


|gr2 = Strings
|gr2= Strings


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


| number call [[BIS_fnc_numberDigits]]
|s1= number call [[BIS_fnc_numberDigits]]


|p1= number: [[Number]] - Number that should be broken down. A float will be '''truncated''', not rounded
|p1= number: [[Number]] - Number that should be broken down. A float will be '''truncated''', not rounded


| [[Array]] of [[Number|Numbers]] - Array of ''number'' digits
|r1= [[Array]] of [[Number|Numbers]] - Array of ''number'' digits


|x1= <code>12345678 [[call]] [[BIS_fnc_numberDigits]]; {{codecomment|// returns [1,2,3,4,5,6,7,8]}}</code>
|x1= <code>12345678 [[call]] [[BIS_fnc_numberDigits]]; {{cc|returns [1,2,3,4,5,6,7,8]}}</code>


|x2= <code>123.9999 [[call]] [[BIS_fnc_numberDigits]]; {{codecomment|// returns [1,2,3]}}</code>
|x2= <code>123.9999 [[call]] [[BIS_fnc_numberDigits]]; {{cc|returns [1,2,3]}}</code>


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


[[Category:Functions|{{uc:numberDigits}}]]
[[Category:{{Name|tkoh}}: Functions|{{uc:numberDigits}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:numberDigits}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:numberDigits}}]]


Line 35: Line 32:
<dd class="note">
<dd class="note">
Use this function with caution: Numbers with more than 8 digits will return wrong results
Use this function with caution: Numbers with more than 8 digits will return wrong results
<code>[11111111]      [[call]] [[BIS_fnc_numberDigits]]; {{cc| returns [1,1,1,1,1,1,1,1]}}[111111111]    [[call]] [[BIS_fnc_numberDigits]]; {{cc| returns [1,1,1,1,1,1,1,1,2]}}[1111111111111] [[call]] [[BIS_fnc_numberDigits]]; {{codecomment|// returns [1,1,1,1,1,1,1,1,0,6,5,6,0]}}</code>
<code>[11111111]      [[call]] [[BIS_fnc_numberDigits]]; {{cc|returns [1,1,1,1,1,1,1,1]}}
[111111111]    [[call]] [[BIS_fnc_numberDigits]]; {{cc|returns [1,1,1,1,1,1,1,1,2]}}
[1111111111111] [[call]] [[BIS_fnc_numberDigits]]; {{cc|returns [1,1,1,1,1,1,1,1,0,6,5,6,0]}}</code>


</dl>
</dl>
<!-- DISCONTINUE Notes -->
<!-- DISCONTINUE Notes -->

Revision as of 22:43, 29 January 2021

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_numberTextBIS_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 March 20, 2018 - 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]