ACE3/addons/common/functions/fnc_numberToString.sqf
Phyma ffaa195fe5 Conform function headers to coding guidelines (#5255)
* Fixed headers to work with silentspike python script

* Fixed rest of the files

* Fixed ace-team
2017-06-08 15:31:51 +02:00

28 lines
576 B
Plaintext

/*
* Author: commy2
* Converts a number to a string without losing as much precission as str or format.
*
* Arguments:
* 0: A number <NUMBER>
*
* Return Value:
* The number as string <STRING>
*
* Example:
* [5] call ace_common_fnc_numberToString
*
* Public: Yes
*/
#include "script_component.hpp"
params ["_number"];
private _decimals = str (abs _number mod 1);
_decimals = toArray _decimals;
_decimals deleteAt 0;
if (_number < 0) exitWith {
format ["-%1%2", floor abs _number, toString _decimals];
};
format ["%1%2", floor _number, toString _decimals];