BIS fnc numberText: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<code>([^<]*)\[\[([a-zA-Z][a-zA-Z0-9_]+)\]\]([^<]*) *<\/code>" to "<code>$1$2$3</code>")
m (Text replacement - "<code>([^<]*)\{\{cc\|([^{}]+)\}\} *<\/code>" to "<code>$1// $2</code>")
Line 23: Line 23:
|r1= [[String]]
|r1= [[String]]


|x1= <code>[4096] call BIS_fnc_numberText; {{cc|"4 096"}}</code>
|x1= <code>[4096] call BIS_fnc_numberText; // "4 096"</code>


|x2= <code>[512, 1] call BIS_fnc_numberText; {{cc|"5 1 2"}}</code>
|x2= <code>[512, 1] call BIS_fnc_numberText; // "5 1 2"</code>


|x3= <code>[999999999999] call BIS_fnc_numberText; {{cc|"909 999 995 904"}}</code>
|x3= <code>[999999999999] call BIS_fnc_numberText; // "909 999 995 904"</code>


|x4= <code>[1234.5678] call BIS_fnc_numberText; {{cc|"1 234"}}</code>
|x4= <code>[1234.5678] call BIS_fnc_numberText; // "1 234"</code>


|seealso= [[BIS_fnc_numberDigits]] [[BIS_fnc_cutDecimals]]
|seealso= [[BIS_fnc_numberDigits]] [[BIS_fnc_cutDecimals]]
}}
}}

Revision as of 23:23, 12 July 2022

Hover & click on the images for description

Description

Description:
Convert a number into string (avoiding scientific notation).
Execution:
call
Problems:
It is very imprecise with larger numbers. See Example 3. It also does not work with floating point numbers.
Groups:
MathStrings

Syntax

Syntax:
[number, modulo] call BIS_fnc_numberText
Parameters:
number: Number
modulo: Number - (Optional, default 3)
Return Value:
String

Examples

Example 1:
[4096] call BIS_fnc_numberText; // "4 096"
Example 2:
[512, 1] call BIS_fnc_numberText; // "5 1 2"
Example 3:
[999999999999] call BIS_fnc_numberText; // "909 999 995 904"
Example 4:
[1234.5678] call BIS_fnc_numberText; // "1 234"

Additional Information

See also:
BIS_fnc_numberDigits 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