client/addons/misc/functions/fnc_formatNumber.sqf
Jacob Schmidt d474b3676a
All checks were successful
Build / Build (push) Successful in 28s
Refactor: Standardize function descriptions and variable handling
This commit refactors several client-side functions to improve code consistency and readability.

- Standardizes function descriptions by removing redundant "Function: forge_client..." prefixes and "[Description]" sections, focusing on concise descriptions of the function's purpose.
- Updates variable handling in arsenal functions to use GVAR and EGVARS for default values, improving consistency and reducing code duplication.
- Removes the bank init function as it is no longer needed.
- Adds a done variable to the preinit file.
2025-05-25 11:30:26 -05:00

42 lines
692 B
Plaintext

#include "..\script_component.hpp"
/*
* Author: IDSolutions
* Formats a number with thousands separators and decimal places
*
* Arguments:
* 0: Number <NUMBER>
*
* Return Value:
* Formatted Number <STRING>
*
* Example:
* [1234567.89] call forge_client_misc_fnc_formatNumber;
*
* Public: Yes
*/
#define PX_DC_SEP "."
#define PX_TH_SEP ","
#define PX_DC_PL 2
private _count = 0;
private _arr = (_this toFixed PX_DC_PL) splitString ".";
private _str = PX_DC_SEP+(_arr select 1);
_arr = toArray(_arr select 0);
reverse _arr;
{
if (_count == 3) then {
_count = 0;
_str = PX_TH_SEP + _str;
};
_str = toString[_x] + _str;
_count = _count + 1;
true
} count (_arr);
_str