mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-16 22:38:34 +02:00
Various QOL improvements and bug fixes
This commit is contained in:
@@ -1211,6 +1211,26 @@ vsprintf
|
||||
|
||||
See `this link <https://github.com/alexei/sprintf.js>`_ for details.
|
||||
|
||||
nFormat
|
||||
^^^^^^^
|
||||
|
||||
.. js:function:: nFormat(n, format)
|
||||
|
||||
:param number n: Number to format
|
||||
:param string format: Formatter
|
||||
|
||||
Converts a number into a string with the specified formatter. This uses the
|
||||
`numeraljs <http://numeraljs.com/>`_ library, so the formatters must be compatible
|
||||
with that.
|
||||
|
||||
This is the same function that the game itself uses to display numbers.
|
||||
|
||||
Examples::
|
||||
|
||||
nFormat(1.23e9, "$0.000a"); // Returns "$1.230b"
|
||||
nFormat(12345.678, "0,0"); // Returns "12,346"
|
||||
nFormat(0.84, "0.0%"); // Returns "84.0%
|
||||
|
||||
prompt
|
||||
^^^^^^
|
||||
|
||||
|
||||
Reference in New Issue
Block a user