From a0d00c0e99aaf7844a330c8e320c0021abb4a3e3 Mon Sep 17 00:00:00 2001 From: "Andrii Doroshenko (Xrayez)" Date: Fri, 4 Oct 2019 14:35:01 +0300 Subject: 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. --- doc/classes/String.xml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'doc/classes') 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] + + + + + + + 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] + + -- cgit v1.2.3