Skip to content

Commit

Permalink
Merge pull request #1309 from CBATeam/fixFormatNumber
Browse files Browse the repository at this point in the history
Fix CBA_fnc_formatNumber for small negative numbers
  • Loading branch information
commy2 committed Mar 16, 2020
2 parents 8568afb + 3ce962b commit 8757f91
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion addons/strings/fnc_formatNumber.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ if (_separateThousands) then { // add localized thousands seperator "1,000"
};
};

if (_isNegative) then {_return = "-" + _return;}; // re-add negative sign
// Re-add negative sign if there is at least one decimal place != 0.
if (_isNegative && {!(toArray _return arrayIntersect toArray "123456789" isEqualTo [])}) then {
_return = "-" + _return;
};

_return

0 comments on commit 8757f91

Please sign in to comment.