summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorAndrii Doroshenko (Xrayez) <xrayez@gmail.com>2019-10-04 14:35:01 +0300
committerAndrii Doroshenko (Xrayez) <xrayez@gmail.com>2019-10-04 15:51:13 +0300
commita0d00c0e99aaf7844a330c8e320c0021abb4a3e3 (patch)
treeb894797b9538690ccaaed429665a9cfd163e63e3 /doc
parent3b2033b9419f76ffaff47654372df1559b6c2b95 (diff)
Bind the `String::humanize_size` method
The method signature is also changed to use `uint64_t` instead of `size_t` for it to be Variant-compatible.
Diffstat (limited to 'doc')
-rw-r--r--doc/classes/String.xml14
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/classes/String.xml b/doc/classes/String.xml
index 03bc2095c0..cf152e716e 100644
--- a/doc/classes/String.xml
+++ b/doc/classes/String.xml
@@ -437,6 +437,20 @@
[/codeblock]
</description>
</method>
+ <method name="humanize_size">
+ <return type="String">
+ </return>
+ <argument index="0" name="size" type="int">
+ </argument>
+ <description>
+ Converts [code]size[/code] represented as number of bytes to human-readable format using internationalized set of data size units, namely: B, KiB, MiB, GiB, TiB, PiB, EiB. Note that the next smallest unit is picked automatically to hold at most 1024 units.
+ [codeblock]
+ var bytes = 133790307
+ var size = String.humanize_size(bytes)
+ print(size) # prints "127.5 MiB"
+ [/codeblock]
+ </description>
+ </method>
<method name="insert">
<return type="String">
</return>